Skip to content

Commit bb034e2

Browse files
committed
fix: handle missing runs
1 parent b9a4a5b commit bb034e2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/fmri_ants_openfmri.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,12 @@ def get_subjectinfo(subject_id, base_dir, task_id, model_id):
285285
taskidx = np.where(taskinfo[:, 0] == 'task%03d' % (idx + 1))
286286
conds.append([condition.replace(' ', '_') for condition
287287
in taskinfo[taskidx[0], 2]])
288-
files = glob(os.path.join(base_dir,
289-
subject_id,
290-
'BOLD',
291-
'task%03d_run*' % (idx + 1)))
292-
run_ids.insert(idx, range(1, len(files) + 1))
288+
files = sorted(glob(os.path.join(base_dir,
289+
subject_id,
290+
'BOLD',
291+
'task%03d_run*' % (idx + 1))))
292+
runs = [int(val[-3:]) for val in files]
293+
run_ids.insert(idx, runs)
293294
TR = np.genfromtxt(os.path.join(base_dir, 'scan_key.txt'))[1]
294295
return run_ids[task_id - 1], conds[task_id - 1], TR
295296

0 commit comments

Comments
 (0)