Skip to content

Commit

Permalink
add space to fname, fix tau computation
Browse files Browse the repository at this point in the history
  • Loading branch information
62442katieb committed Jun 29, 2022
1 parent a763e32 commit 97b125f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ var/
**.pyc
**.egg*
**/__pycache__/**
idconn/connectivity/__pycache__/__init__.cpython-37.pyc
__pycache__/versioneer.cpython-37.pyc
idconn/__pycache__/_version.cpython-37.pyc
4 changes: 2 additions & 2 deletions idconn/connectivity/build_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def task_connectivity(layout, subject, session, task, atlas, confounds, connecti
ex_bold = image.index_img(bold_file[0], 2)
display = plotting.plot_epi(ex_bold)
display.add_contours(atlas)
display.savefig(join(deriv_dir, f'sub-{subject}', f'ses-{session}', 'func', f'sub-{subject}_ses-{session}_task-{task}_run-{run}_desc-{atlas_name}_overlay.png'))
display.savefig(join(deriv_dir, f'sub-{subject}', f'ses-{session}', 'func', f'sub-{subject}_ses-{session}_task-{task}_run-{run}_space-MNI152NLin2009cAsym_space-{atlas_name}_overlay.png'))

print(f'BOLD file located at {bold_file}\nTR = {tr}s')

Expand Down Expand Up @@ -156,7 +156,7 @@ def task_connectivity(layout, subject, session, task, atlas, confounds, connecti
corrmat_df = pd.DataFrame(index=np.arange(1, avg_corrmat.shape[0]+1), columns=np.arange(1, avg_corrmat.shape[0]+1),data=avg_corrmat)
avg_corrmats[condition] = corrmat_df
corrmat_file = join(deriv_dir,
f'sub-{subject}', f'ses-{session}', 'func', f'sub-{subject}_ses-{session}_task-{task}_condition-{condition}_desc-{atlas_name}_corrmat.tsv')
f'sub-{subject}', f'ses-{session}', 'func', f'sub-{subject}_ses-{session}_task-{task}_desc-{condition}_space-MNI152NLin2009cAsym_atlas-{atlas_name}_corrmat.tsv')
try:
corrmat_df.to_csv(corrmat_file, sep='\t')
files.append(corrmat_file)
Expand Down
4 changes: 2 additions & 2 deletions idconn/connectivity/estimate_thresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def connected_tau(corrmat, proportional=True):
tau : float
Highest vaue of tau (threshold) at which network becomes node-connected.
'''
tau = 1
tau = 0.01
connected = False
while connected == False:
if proportional:
Expand All @@ -56,5 +56,5 @@ def connected_tau(corrmat, proportional=True):
w = bct.threshold_absolute(corrmat, tau)
w_nx = nx.convert_matrix.from_numpy_array(w)
connected = nx.algorithms.components.is_connected(w_nx)
tau -= 0.01
tau += 0.01
return tau

0 comments on commit 97b125f

Please sign in to comment.