Skip to content

topup acquisitions break things in BIDSlayout #430

@toddt

Description

@toddt

I have an experiment that contains topup acquisitions that I've run through heudiconv and fmriprep.

When I now run:

data_dir = '/foo/bar/'
sub = 'test sub'
layout = BIDSLayout(data_dir)
scaninfo = layout.get_collections(level='session',subject=sub)

I get an error here:

/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/bids/variables/io.py in load_tsv_variables(layout, type, dataset, columns, prepend_type, **selectors)
382 patt = '|'.join(ent_patts)
383
--> 384 _data = _data[_data[col].str.contains(patt)]
385
386 level = {'scans': 'session', 'sessions': 'subject',

AttributeError: 'DataFrame' object has no attribute 'str'

I dug into this a bit with pdb, and what's going on looks like this:

  1. The line above is failing because _data[col].str.contains(patt) returns a dataframe, not a series. The dataframe in this case is two columns named 'subject'.

_data = _data.T.drop_duplicates().T

should, in theory, address that, but it doesn't because the two subject columns are not the same. One column has four NaN rows at the end.

My guess is that there's a disconnect between the series the scans.tsv files knows about and the series that get_collections knows about, and the NaN rows result from an attempt to munge those two sets together.

Removing the topup series lines from the scans.tsv file fixed the problem entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions