-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add BIDSJSONFile #444
Add BIDSJSONFile #444
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added a few suggestions.
So this is only a preamble to get #442 "addressed"?
(git-annex)hopa:~/datalad/openfmri/ds000001[master]git
$> python -c "from pprint import pprint; import bids; b = bids.BIDSLayout('.'); print('Version: ', bids.__version__); pprint(b.get_metadata('dataset_description.json'))"
('Version: ', '0.8.0+208.g5860e4f')
{}
$> python -c "from pprint import pprint; import bids; b = bids.BIDSLayout('.'); print('Version: ', bids.__version__); pprint(b.get_metadata('$PWD/dataset_description.json'))"
('Version: ', '0.8.0+208.g5860e4f')
{}
j = jf.get_json() | ||
assert isinstance(j, six.string_types) | ||
assert 'RepetitionTime' in j | ||
assert json.loads(j) == d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a test specifically on dataset_description.json
would be great
Codecov Report
@@ Coverage Diff @@
## master #444 +/- ##
==========================================
+ Coverage 82.61% 83.51% +0.89%
==========================================
Files 23 23
Lines 2848 3039 +191
Branches 718 829 +111
==========================================
+ Hits 2353 2538 +185
- Misses 314 321 +7
+ Partials 181 180 -1
Continue to review full report at Codecov.
|
Co-Authored-By: Yaroslav Halchenko <[email protected]>
Re: getting #442 addressed, I'm not sure I follow... as I said in the other thread, I see the fact that |
ah, ok, gotcha.
although generally the case, with dataset_description.json I could argue it is different since it describes the entire dataset, so this metadata is relevant to all files, including meta- data in the dataset, and thus itself as well. So now I would need to use explicitly |
For the special case of Edit: or maybe just |
I kinda liked But I also wondered, that |
I'm not crazy about the idea of making |
@yarikoptic please check to make sure this implementation of |
@yarikoptic just pinging you about this... totally fine if you don't have time to look it over. I'm happy with it and can merge as-is. |
@yarikoptic Care to have another review? |
Oh, sorry for missing the pings! I will check how things work out for datalad-neuroimaging later today - away from the laptop ATM |
Hi @yarikoptic, did you get a chance to test this out? |
doing it now, if you don't hear from me within an hour -- forget I exist and proceed forward and I will show my "pretty" face later on ;-) |
ok, initial wave -- made datalad-neuroimaging compatible with current branch by using will try now on some openneuro dataset to see what potentially has changed in the output |
ran into some other gotchas, will report on that separately -- don't wait! carry on (feel welcomed to merge, sorry for the delays!) |
Sounds good. Thanks for the review. |
just for my own sake -- tested on ds00258. Differences from using 0.8 just added extension and absent probably bogus super precise float @@ -4456,10 +4458,11 @@
2.38766666667,
1.15266666667
],
- "SpacingBetweenSlices": 4.840000000000001,
+ "SpacingBetweenSlices": 4.84,
"TaskName": "rest",
"datatype": "func",
"echo": "2",
+ "extension": "nii.gz",
"subject": "04570",
"suffix": "bold",
"task": "rest" differences from some prior (0.5...?) version (to 0.8 and this) include loss of metadata from derivatives folders... I guess we needed to adjust more ;-) |
Version 0.9.2 (July 12, 2019) This version includes a number of minor fixes and improvements. EEG files are better handled, and `BIDSLayout` and `BIDSFile` play more nicely with `Path`-like objects. With thanks to new contributor Cecile Madjar. * FIX: Instantiate `ignore`/`force_index` after root validation (bids-standard#457) * FIX: Restore `<entity>=None` query returning files lacking the entity (bids-standard#458) * ENH: Add `BIDSJSONFile` (bids-standard#444) * ENH: Add `BIDSFile.__fspath__` to work with pathlib (bids-standard#449) * ENH: Add `eeg` datatype to layout config (bids-standard#455) * RF: Remove unused kwargs to BIDSFile (bids-standard#443) * DOC: Improve docstring consistency, style (bids-standard#443) * DOC: Address final JOSS review (bids-standard#453) * STY: PEP8 Fixes (bids-standard#456) * MAINT: Set name explicitly in setup.py (bids-standard#450) * tag '0.9.2': (318 commits) MAINT: Update changelog, Zenodo ordering fix(BIDSLayout): more readable query building tst(BIDSLayout): add two more tests to the entity=None case FIX: Allow None to select for the absence of a tag TEST: Verify entity=None fails to find files lacking that entity FIX: Instantiate ignore/force_index after root validation fix test revert turning '==' into 'is' pep8 fixes fix typo in docstring fix typo and added eeg to the config bids.json file TEST: Expect failure on Python < 3.6 TEST: Verify Path can accept a BIDSFile ENH: Add BIDSFile.__fspath__ to work with pathlib DOC: Fix BIDS citation DOC: Spaces around emdashes, italicize e.g., i.e. DOC: Drop Zenodo reference DOC: Update bibliography file with eye to formatting fix name in setup.py so used-by count works; h/t @effigies DOC: Add PyPI badge for latest version available ...
Now that bids-standard/pybids#444 was merged/released
Now that bids-standard/pybids#444 was merged/released
Adds a
BIDSJSONFile
to theBIDSFile
hierarchy. This introduces.get_dict()
and.get_json()
methods that return the contents of a .json file. See #442 for discussion.