Skip to content

Make pybids tutorial notebook great again #265

@yarikoptic

Description

@yarikoptic

ATM it is broken at layout.get(type='T1w', subject='01') puking with

~/proj/bids/pybids > cat pybids-tut.py          
import bids.layout   
import bids.tests
import os
layout = bids.layout.BIDSLayout(os.path.join(bids.tests.get_test_data_path(), '7t_trt'))
print(layout.get()[10])

print(layout.get(type='T1w', subject='01'))

~/proj/bids/pybids > python pybids-tut.py
File(filename='/home/yoh/proj/bids/pybids/bids/tests/data/7t_trt/sub-01/ses-1/fmap/sub-01_ses-1_run-2_phasediff.json', datatype='fmap', session='1', run=2, suffix='phasediff', subject='01')
Traceback (most recent call last):
  File "pybids-tut.py", line 7, in <module>
    print(layout.get(type='T1w', subject='01'))
  File "/home/yoh/proj/bids/pybids/bids/layout/layout.py", line 288, in get
    **md_kwargs)
  File "/home/yoh/proj/bids/pybids/bids/layout/layout.py", line 524, in search
    self.index_file(f)
  File "/home/yoh/proj/bids/pybids/bids/layout/layout.py", line 465, in index_file
    if f.path in self.file_index and not overwrite:
AttributeError: 'File' object has no attribute 'path'

blind attempt to fix in grabbit which somewhat brakes API (.filename of the namedtuple File becomes just the filename, not .path) is not sufficient alone, but I didn't want to dive deeper before decision on that one was made

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