Skip to content

Commit a23f47a

Browse files
committed
fix: select task specific scan key if available
1 parent f79cf64 commit a23f47a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/fmri_ants_openfmri.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,13 @@ def get_subjectinfo(subject_id, base_dir, task_id, model_id):
562562
'task%03d_run*' % (idx + 1))))
563563
runs = [int(val[-3:]) for val in files]
564564
run_ids.insert(idx, runs)
565-
TR = np.genfromtxt(os.path.join(base_dir, 'scan_key.txt'))[1]
565+
task_scan_key = os.path.join(base_dir, subject_id, 'BOLD',
566+
'task%03d_run%03d' % (task_id, run_ids[0]),
567+
'scan_key.txt')
568+
if os.path.exists(task_scan_key):
569+
TR = np.genfromtxt(task_scan_key)[1]
570+
else:
571+
TR = np.genfromtxt(os.path.join(base_dir, 'scan_key.txt'))[1]
566572
return run_ids[task_id - 1], conds[task_id - 1], TR
567573

568574
"""

0 commit comments

Comments
 (0)