MRG: Warn if NIRX directory structure has been modified from original format#7898
Merged
larsoner merged 1 commit intomne-tools:masterfrom Jun 15, 2020
Merged
MRG: Warn if NIRX directory structure has been modified from original format#7898larsoner merged 1 commit intomne-tools:masterfrom
larsoner merged 1 commit intomne-tools:masterfrom
Conversation
5fcdad0 to
c544ded
Compare
agramfort
reviewed
Jun 14, 2020
mne/io/nirx/tests/test_nirx.py
Outdated
| with pytest.raises(RuntimeWarning, match='A single dat'): | ||
| read_raw_nirx(fname, preload=True) | ||
| os.rename(fname_nirx_15_2_short + "/NIRS-2019-08-23_001.tmp", | ||
| fname_nirx_15_2_short + "/NIRS-2019-08-23_001.dat") |
Member
There was a problem hiding this comment.
this is for me dangerous as if the lines above fail you will never revert the renaming.
Member
Author
There was a problem hiding this comment.
Agreed. Could I not have a test for this? It will drop the code coverage :(
Or is there another way you would suggest?
Member
There was a problem hiding this comment.
@rob-luke the way we usually solve this is with the pattern:
def test_whatever(tmpdir): # pytest builtin tmpdir fixture
shutuil.copytree(orig_dir, str(tmpdir))
# mess with files in tmpdir
...
read_raw_nirx(tmpdir.join('whatever.ext'))
pytest takes care of creating and destroying the tmpdir directory
Member
|
maybe a try finally construct?
… |
Member
Author
|
@larsoner @agramfort could you please review, this failure seems due to the Mac CI exceeding its time limit. |
agramfort
approved these changes
Jun 15, 2020
Member
Author
|
a 16 second turn around. Surely that's a record, thanks @agramfort |
Member
|
:)
… |
larsoner
reviewed
Jun 15, 2020
| os.rename(str(tmpdir) + "/data" + "/NIRS-2019-08-23_001.dat", | ||
| str(tmpdir) + "/data" + "/NIRS-2019-08-23_001.tmp") | ||
| fname = str(tmpdir) + "/data" + "/NIRS-2019-08-23_001.hdr" | ||
| with pytest.raises(RuntimeWarning, match='A single dat'): |
Member
There was a problem hiding this comment.
usually we use pytest.warns, but I suppose this works, too
Member
|
Thanks @rob-luke |
larsoner
added a commit
to GuillaumeFavelier/mne-python
that referenced
this pull request
Jun 16, 2020
* upstream/master: MRG, FIX: Speed up I/O tests, mark some slow (mne-tools#7904) Proper attribution for Blender tutorial (mne-tools#7900) MAINT: Check usage [ci skip] (mne-tools#7902) Allow find_bad_channels_maxwell() to return scores (mne-tools#7845) Warn if NIRx directory structure has been modified from original format (mne-tools#7898)
larsoner
added a commit
to larsoner/mne-python
that referenced
this pull request
Jun 17, 2020
* upstream/master: (24 commits) WIP: Fix Travis (mne-tools#7906) WIP: Prototype of notebook viz (screencast) (mne-tools#7758) MRG, FIX: Speed up I/O tests, mark some slow (mne-tools#7904) Proper attribution for Blender tutorial (mne-tools#7900) MAINT: Check usage [ci skip] (mne-tools#7902) Allow find_bad_channels_maxwell() to return scores (mne-tools#7845) Warn if NIRx directory structure has been modified from original format (mne-tools#7898) Pin pvyista to 0.24.3 (mne-tools#7899) MRG: Add support for reading and writing sufaces to .obj (mne-tools#7824) Fix _auto_topomap_coords docstring. (mne-tools#7895) MRG, FIX: Ensure Info H5-writeable (mne-tools#7887) Website contents (mne-tools#7889) MRG, ENH: Add mri_resolution="sparse" (mne-tools#7888) MRG, ENH: Allow disabling FXAA (mne-tools#7877) remove "and and" [ci skip] (mne-tools#7882) fix evoked nave → inverse guidance (mne-tools#7881) ENH: Better error messages (mne-tools#7879) FIX : EDF+ Annotation Timestamps missing sub-second accuracy (mne-tools#7875) FIX: Fix get_channel_types (mne-tools#7878) MRG, BUG: Fix combine evokeds (mne-tools#7869) ...
larsoner
added a commit
to larsoner/mne-python
that referenced
this pull request
Jun 25, 2020
* upstream/master: (23 commits) MAINT: Add mne.surface to docstring tests (mne-tools#7930) MRG: Add smoothing controller to TimeViewer for the notebook backend (mne-tools#7928) MRG: TimeViewer matplotlib figure color (mne-tools#7925) fix typos (mne-tools#7924) MRG, ENH: Add method to project onto max power ori (mne-tools#7883) WIP: Warn if untested NIRX device (mne-tools#7905) MRG, BUG: Fix bug with volume morph and subject_to!="fsaverage" (mne-tools#7896) MRG, MAINT: Clean up use of bool, float, int (mne-tools#7917) ENH: Better error message for incompatible Evoked objects (mne-tools#7910) try to fix nullcontext (mne-tools#7908) WIP: Fix Travis (mne-tools#7906) WIP: Prototype of notebook viz (screencast) (mne-tools#7758) MRG, FIX: Speed up I/O tests, mark some slow (mne-tools#7904) Proper attribution for Blender tutorial (mne-tools#7900) MAINT: Check usage [ci skip] (mne-tools#7902) Allow find_bad_channels_maxwell() to return scores (mne-tools#7845) Warn if NIRx directory structure has been modified from original format (mne-tools#7898) Pin pvyista to 0.24.3 (mne-tools#7899) MRG: Add support for reading and writing sufaces to .obj (mne-tools#7824) Fix _auto_topomap_coords docstring. (mne-tools#7895) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue
Fixes #7894. @swy7ch noted that the NIRX file reader checks for a dat file, but it is not used.
What does this implement/fix?
Instead of failing if the
.datis missing this now throws a warning to the user that the file structure has been modified from what the measurement machine saved.Additional information
We have had some discussion about what the correct behaviour is. See the above linked issue for discussion.