Skip to content

Commit ac31682

Browse files
committed
♻️ Handle 'sub' and 'ses' not in strings
1 parent b656d13 commit ac31682

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CPAC/qc/xcp.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,12 @@ def get_bids_info(subject, scan, wf_name):
325325
run ID
326326
"""
327327
returns = ('subject', 'session', 'task', 'run')
328-
resource = '_'.join([subject, wf_name,
328+
ses = wf_name.split('_')[-1]
329+
if not ses.startswith('ses-'):
330+
ses = f'ses-{ses}'
331+
if not subject.startswith('sub-'):
332+
subject = f'sub-{subject}'
333+
resource = '_'.join([subject, ses,
329334
scan if 'task' in scan else f'task-{scan}'])
330335
entities = parse_file_entities(resource)
331336
returns = {key: entities.get(key) for key in returns}

0 commit comments

Comments
 (0)