Skip to content

Loading collections fails when derivatives is outside parent directory #383

@adelavega

Description

@adelavega

If layout is set up as such:
layout = BIDSLayout('/bids', derivatives='/fmriprep')

Then the following will fails
layout.get_collections()

because the TR for an image in the derivatives can't be found:

~/repos/pybids/bids/variables/io.py in load_variables(layout, types, levels, skip_empty, dataset, **kwargs)
     74         _kwargs = kwargs.copy()
     75         _kwargs.update(type_flags)
---> 76         dataset = _load_time_variables(layout, dataset, **_kwargs)
     77
     78     for t in ({'scans', 'sessions', 'participants'} & set(types)):

~/repos/pybids/bids/variables/io.py in _load_time_variables(layout, dataset, columns, scan_length, drop_na, events, physio, stim, regressors, skip_empty, **selectors)
    160
    161         tr = layout.get_metadata(img_f, suffix='bold', domains=domains,
--> 162                                  full_search=True)['RepetitionTime']
    163
    164         run = dataset.get_or_create_node('run', entities, image_file=img_f,

KeyError: 'RepetitionTime'

If I instead add a symlink to derivatives/fmriprep then it works.

This might be a more general issue of how meta-data is searched when the root folder differs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions