Skip to content

Commit

Permalink
Merge pull request #204 from adelavega/filter_desc
Browse files Browse the repository at this point in the history
Add desc=preproc as filter when finding preproc BOLD files
  • Loading branch information
adelavega authored Dec 11, 2019
2 parents ea92778 + f818dc6 commit dd9948b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fitlins/interfaces/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _load_level1(self, runtime, analysis):
TR = ents.pop('RepetitionTime', None) # Required field in seconds
if TR is None: # But is unreliable (for now?)
preproc_files = analysis.layout.get(
extension=['.nii', '.nii.gz'], **ents)
extension=['.nii', '.nii.gz'], desc='preproc', **ents)
if len(preproc_files) != 1:
raise ValueError('Too many BOLD files found')

Expand Down Expand Up @@ -393,18 +393,18 @@ def _run_interface(self, runtime):
mask_files = []
entities = []
for ents in self.inputs.entities:
selectors = {**self.inputs.selectors, **ents}
selectors = {'desc': 'preproc', **self.inputs.selectors, **ents}
bold_file = layout.get(**selectors)

if len(bold_file) == 0:
raise FileNotFoundError(
"Could not find BOLD file in {} with entities {}"
"".format(self.inputs.bids_dir, selectors))
"".format(layout.root, selectors))
elif len(bold_file) > 1:
raise ValueError(
"Non-unique BOLD file in {} with entities {}.\n"
"Matches:\n\t{}"
"".format(self.inputs.bids_dir, selectors,
"".format(layout.root, selectors,
"\n\t".join(
'{} ({})'.format(
f.path,
Expand Down

0 comments on commit dd9948b

Please sign in to comment.