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 write_raw_bids() raise if an unsuitable extension is provided in the BIDSPath #1053

Closed

Conversation

hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Aug 19, 2022

Some extensions / formats are only allowed for certain data types, e.g. .vhdr is (i)EEG-only.

When passing a BIDSPath containing both datatype and extension to write_raw_bids(), in case of a mismatch we would previously simply silently replace the incorrect extension, effectively writing to a location (and file format) the user didn't expect.

We now raise an exception in such situations.

Fixes #1041

Merge checklist

Maintainer, please confirm the following before merging.
If applicable:

  • All comments are resolved
  • This is not your own PR
  • All CIs are happy
  • PR title starts with [MRG]
  • whats_new.rst is updated
  • New contributors have been added to CITATION.cff
  • PR description includes phrase "closes <#issue-number>"

… the BIDSPath

Some extensions / formats are only allowed for certain data types, e.g.
.vhdr is (i)EEG-only.

When passing a BIDSPath containing both datatype and extension
to write_raw_bids(), in case of a mismatch we would previously simply
silently replace the incorrect extension, effectively writing to a
location (and file format) the user didn't expect.

We now raise an exception in such situations.

Fixes mne-tools#1041
@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #1053 (f99b052) into main (d98128a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1053   +/-   ##
=======================================
  Coverage   95.20%   95.20%           
=======================================
  Files          25       25           
  Lines        3815     3816    +1     
=======================================
+ Hits         3632     3633    +1     
  Misses        183      183           
Impacted Files Coverage Δ
mne_bids/write.py 97.15% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

Successfully merging this pull request may close these issues.

write_raw_bids() accepts (and silently ignores / alters) unsuitable extension
1 participant