Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pybids tutorial notebook great again #265

Closed
yarikoptic opened this issue Oct 10, 2018 · 5 comments
Closed

Make pybids tutorial notebook great again #265

yarikoptic opened this issue Oct 10, 2018 · 5 comments

Comments

@yarikoptic
Copy link
Collaborator

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

@tyarkoni
Copy link
Collaborator

See #259; closing here. The fix is to use suffix instead of type.

@yarikoptic
Copy link
Collaborator Author

oy... What should type reflect then? If it must not be present at all, at least at pybids level, then it might better to explicitly check if it is given and puke with an informative message (instead of delaying and exploding deep inside the guts)

@tyarkoni
Copy link
Collaborator

type is gone--it was inconsistent with the naming conventions used in the spec. I agree it would probably be a good idea to spit out a more informative error. Want to open a PR for that? :)

@yarikoptic
Copy link
Collaborator Author

Ok will do

@tyarkoni
Copy link
Collaborator

Also, see the Changelog for a summary of most (all?) of the breaking changes. I think the entity renaming and the path specification are the two major ones, but there might be other things we should probably flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants