mne-bids
mne-bids copied to clipboard
write_raw_bids hits ValueError on BIDSVersion if BIDSversion used is greater then 1.4.0
Right now, in make_dataset_description
, an error is raised if your existing dataset_description.json
has BIDSVersion = 1.5.0
.
However, isn't BIDS backwards compatible? So the only issue should be if we're trying to write to a dataset using a higher BIDS version. I mean of course, BIDS isn't to a stable state where versioning actually is accounted for in the validator/here, but perhaps we can just raise an error if the current version is less than MNE-BIDS BIDS version? E.g.
# should this be <, <=, >, or >=? I don't think it should be != which it is currently?
if 'BIDSVersion' in orig_cols and \
version.parse(orig_cols['BIDSVersion']) < version.parse(BIDS_VERSION):
raise ValueError('Previous BIDS version used, please redo the '
'conversion to BIDS in a new directory '
'after ensuring all software is updated')
Reference: https://stackoverflow.com/questions/11887762/how-do-i-compare-version-numbers-in-python
I would actually say that the only version of BIDS we properly support at any time is the latest development version 😬
I would actually say that the only version of BIDS we properly support at any time is the latest development version
I agree ... and while that's obviously problematic, it ties in well with how the bids-validator behaves.
In an ideal world, a given BIDS version would be set in stone, and all tools (including bids-validator, mne-bids, etc), dataset examples, etc. would be released with versions tracking the BIDS spec.
So that it'd be totally fine for me to work in BIDS 1.1, and have all tools work and the vaildator pass (if I use it at version 1.1). But that's unfortunately currently not the case - to some extent (I think) because we are moving too fast with too many people that do not develop software. Hence everything BUT the software is advancing too fast, while some key parts lack behind (not only software actually, but also user documentation, best-practices, and examples, see bids-starter-kit)
Should we then:
- change error to warning
- error only when BIDS version in mne-bids is less than what's already in
dataset_description
- error only when BIDS version in mne-bids is greater than what's already in
dataset_description
- keep as is ?
I hope this is the right / sufficiently related issue for my use case: Assume you want to handle the empty rooms for Cam-CAN (which ships them as separate directory in the "wrong" place) using the latest find empty room support. My Cam-CAN release is written in BIDSVersion 1.4; I am now using 1.7. I can apparently do nothing to add an emptyroom
subject there, which forces me to free another 0.5TB on disk to create a new (copy) of the dataset.
I see this as problematic when working with datasets that have been released already. Can one expect that people re-write big datasets anew to satisfy version matches?
Would it make sense to support multiple versions to allow select which version of the standard to use when writing files?
Are there any current initiatives to resolve this?
I am using Heaudiconv to convert MRI DICOM data into BIDS, tailing the conversion with MNE-BIDS to convert any EEG resources data. If the BIDS Versions in the dataset_description.json (which will already have been created by Heudiconv) are out of sync, MNE fails with this error. Since BIDS is backwards compatible, I don't believe this should occur and the error should be changed to a warning.
I agree. Would you like to try and change this, @fordmcdonald?
Totally! It would be my pleasure. Do I need to be granted permission to push changes to a new branch? @hoechenberger
No, you just fork this repository, work on your own branch, and then create a pull request
Hmm. I'm getting a remote: Permission to mne-tools/mne-bids.git denied to fordmcdonald.
when I attempt to push to my branch on the remote origin (git push -u origin fix-incompatible-bids-versions) @hoechenberger
@fordmcdonald you should first fork the repository, and only push to fordmcdonald/mne-bids.git
... to some new branch of your choice. Then in a next step you can open a pull request from that branch on your fork to mne-tools/mne-bids' main branch.