Skip to content

Commit

Permalink
Merge pull request #104 from neuroscout/fix/metadata
Browse files Browse the repository at this point in the history
Fetch all fmriprep metadata for pybids index_metadata to work
  • Loading branch information
adelavega committed Apr 9, 2020
2 parents 734f505 + 43026e0 commit a187346
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions neuroscout_cli/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ def download_data(self):
install(source=self.resources['preproc_address'],
path=str(self.preproc_dir.parents[0]))

get(str(self.preproc_dir / 'dataset_description.json'))
# Get all JSON files
get([str(p) for p in self.preproc_dir.rglob('*.json')])

layout = BIDSLayout(self.preproc_dir, derivatives=self.preproc_dir)
layout = BIDSLayout(
self.preproc_dir,
derivatives=self.preproc_dir, index_metadata=False)

paths = layout.get(
**model['input'], desc='preproc', return_type='file')
Expand All @@ -79,8 +82,11 @@ def download_data(self):
unlock(paths)

except Exception as e:
message = e.failed[0]['message']
raise ValueError("Datalad failed. Reason: {}".format(message))
if hasattr(e, 'failed'):
message = e.failed[0]['message']
raise ValueError("Datalad failed. Reason: {}".format(message))
else:
raise(e)

# Copy meta-data to root of dataset_dir
copy(list(self.bundle_dir.glob('task-*json'))[0], self.preproc_dir)
Expand Down

0 comments on commit a187346

Please sign in to comment.