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

Fix SNIRF duration writing bug #497

Merged
merged 6 commits into from
Jan 4, 2023
Merged

Conversation

rob-luke
Copy link
Member

@rob-luke rob-luke commented Jan 2, 2023

Reference issue

SNIRF file should write stims/annotations with the following format: [starttime duration value].
As described here: https://github.com/fNIRS/snirf/blob/master/snirf_specification.md#nirsistimjdata

What does this implement/fix?

Modifes the write_raw_snirf function to write stims according to the format above.
Added tests to ensure round trip read-write is lossless for stimulus parameters.

Additional information

This also requires a change to MNE here: mne-tools/mne-python#11397

@codecov
Copy link

codecov bot commented Jan 2, 2023

Codecov Report

Merging #497 (c1e4390) into main (3c81e9d) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #497      +/-   ##
==========================================
+ Coverage   95.26%   95.31%   +0.05%     
==========================================
  Files          69       69              
  Lines        2724     2754      +30     
  Branches      394      394              
==========================================
+ Hits         2595     2625      +30     
  Misses         65       65              
  Partials       64       64              
Impacted Files Coverage Δ
mne_nirs/io/snirf/_snirf.py 95.48% <100.00%> (ø)
mne_nirs/io/snirf/tests/test_snirf.py 97.50% <100.00%> (+0.83%) ⬆️

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

@rob-luke
Copy link
Member Author

rob-luke commented Jan 3, 2023

@larsoner could you please review. Specifically, I am unsure about my skipping of tests for pre 1.4 and if this is a bad idea?

@larsoner
Copy link
Member

larsoner commented Jan 3, 2023

Up to you if you want to skip. Another slightly more complete option would be to triage based on < 1.4 or >= 1.4 and check that the duration matches expectation, e.g. 5 on < 1.4 and the correct value(s) on >= 1.4. But this is probably overkill. Feel free to merge if you're happy with this version!

@rob-luke
Copy link
Member Author

rob-luke commented Jan 4, 2023

Thanks mate, in it goes!

@rob-luke rob-luke merged commit b2f978d into mne-tools:main Jan 4, 2023
@rob-luke rob-luke deleted the snirfduration branch January 4, 2023 04:00
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.

2 participants