Fix export to EDF format with a set physical range smaller than the data range#11569
Merged
larsoner merged 2 commits intomne-tools:mainfrom Mar 17, 2023
Merged
Fix export to EDF format with a set physical range smaller than the data range#11569larsoner merged 2 commits intomne-tools:mainfrom
larsoner merged 2 commits intomne-tools:mainfrom
Conversation
Member
|
Nice @mscheltienne , I can't find anything to complain about! In it goes |
larsoner
added a commit
to larsoner/mne-python
that referenced
this pull request
Mar 20, 2023
* upstream/main: Fix bug in new `mne.sys_info()` (mne-tools#11577) Remove legacy plot_psd* funcs/methods in our docs and codebase (mne-tools#11563) The order of raw1.info["bads"] should not matter when concatenating with raw0.info["bads"] mne-tools#11501 (mne-tools#11502) MAINT: Fixes for matplotlib and pandas (mne-tools#11574) Fix Circle [circle deploy] Fix export to EDF format with a set physical range smaller than the data range (mne-tools#11569) Slightly rework `mne.sys_info()` (mne-tools#11568)
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.
Today, I had a researcher from our sleep lab that came-in with a ~8 hours long night recording that could not be converted to EDF either through the BrainVision software or through MNE. The converted signals were all "flat" (or mostly flat), and this was due to 10' in the recording (around hour 7 ) where the signal went completely off-scale, for whatever reason.
The physical range is estimated here
mne-python/mne/export/_edf.py
Lines 122 to 131 in 6384a89
On a good file, I get:
pmin = ~ -130kandpmax= ~ 80k. The range is in the~ 250kscale. On the bad file, the range was in the~ 10Mor100Mrange, several order of magnitude larger. Thus, the conversion failed.By setting the
physical_rangeto(-150000, 80000)in the BrainVision software or in MNE, the data could be exported to EDF and the 10' segment off-scale is saturating as expected. However, in MNE, I did have to comment out this sanity-checkmne-python/mne/export/_edf.py
Lines 143 to 149 in 6384a89
I am not familiar at all with the EDF format, and might be missing something; but IMO it should be a warning instead of a raise.