Repository navigation
fix EDF round-trip - #14296
fix EDF round-trip#14296
Conversation
larsoner
left a comment
There was a problem hiding this comment.
No need for you to leave inline comments this ended up looking pretty straightforward! But if you want to make them to call out things for me specifically to look at (or just to document the challenges / suffering involved 😄 ) feel free
drammock
left a comment
There was a problem hiding this comment.
Locally, the remaining failing checks seem to be an EDFIO bug, where it fails to properly truncate a physical_min float value to 8 characters. Example:
np.float64(-1e-05) gets converted to -1.001e-05 (10 chars, not 8) because of how edfio.edf_signal._round_float_to_8_characters works (it searches for a literal decimal point and uses its index, and in the input here there is no decimal point). I'll open an upstream issue/PR later today.
| digital_min, digital_max = -32768, 32767 # 16-bit | ||
| signal_class = EdfSignal | ||
| writer_class = Edf | ||
| else: # BDF | ||
| digital_min, digital_max = -8388607, 8388607 # 24-bit | ||
| digital_min, digital_max = -8388608, 8388607 # 24-bit |
There was a problem hiding this comment.
this was another bug revealed by testing roundtrip equivalance of files in the testing dataset. Or at least, this change fixed RT-equivalence for that file... and it reflects the actual digital minima so I think it's a genuine bugfix
For these maybe for now we can just I'll take a quick look at the one that seems like it should succeed but if this already improves the situation, I'm inclined to merge as-is (or if you want to |
|
Ohhh there are existing tests that now fail, that's not so good. Want me to look at those? |
sure. I've just xfailed 2 of them (they're affected by the float-truncation problem I mentioned before) but there's one other test that's now failing and might indicate that I broke something when user passes a concrete |
|
Okay so one thing will make a couple of the tests pass even with the EDFIO bug -- writing A second fix is to make it so that a symmetric digital range is used (when I also found it much easier to follow the logic by hoisting the physical / digital range triages out of the loops. Then the |
* upstream/main: (75 commits) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) Move toward docstacks [circle deploy] [skip azp] [skip actions] Fix tfce (mne-tools#14286) FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773) Don't shift placeholder proc_history dates in anonymize_info (mne-tools#14248) ... # Conflicts: # mne/io/edf/tests/test_edf.py
I want to be cautious here. Locally when I patched EDFIO to avoid the float-to-string error, those same tests were still failing (which probably means something else is still broken/incorrect now). I'll take a look now |
| remap_dict["uv"] = "µV" | ||
| remap_dict["μv"] = "µV" # greek letter mu vs micro sign. use micro | ||
| remap_dict["\x83\xcav"] = "µV" # for shift-jis mu, use micro | ||
| remap_dict["\x83\xcaV".lower()] = "µV" # for shift-jis mu, use micro |
There was a problem hiding this comment.
puzzled by this change; presumably it was added as a lowercase v by the original committer because that's what's attested in their files. This change keeps the same behavior but in a (to me) confusing/roundabout way. Can you explain the thinking here?
Co-authored-by: Daniel McCloy <[email protected]> Co-authored-by: Eric Larson <[email protected]>
| # character in shift-jis encoding, it gets read in as utf-8, where `\xca` is an | ||
| # (uppercase) Ê. Elsewhere in the codebase we call a `.lower()` on these strings | ||
| # so if the keys here aren't also `.lower()` then the key will fail to be | ||
| matched. |
There was a problem hiding this comment.
Uhoh we got this in main and maint/1.13 🤦
I guess we'll go with a 1.13.2!
* upstream/main: (22 commits) fix EDF round-trip (mne-tools#14296) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) Move toward docstacks [circle deploy] [skip azp] [skip actions] Fix tfce (mne-tools#14286) FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773) ... # Conflicts: # mne/viz/backends/tests/test_renderer.py
* upstream/main: (25 commits) ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150) FIX: Ver [circle deploy] [skip azp] [skip actions] Hotfix fix EDF round-trip (mne-tools#14296) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) ...
…d-sphere * commit '0311e444b0450ce9d2b2b304cebe7d5343533357': Fix static doc viewing in IDEs (mne-tools#14195) Fix COLA for odd sizes (mne-tools#14312) add type hints to mne/_fiff/ module (mne-tools#14278) ENH: wire the JupyterLite build into the docs (JupyterLite split 5/5) (mne-tools#14157) MAINT: Update pre-commit hook versions (mne-tools#14306) Small documentation fix for "Frequency and time-frequency sensor analysis" tutorial (mne-tools#14304) FIX: don't mutate cached ICA sources in plot_sources properties (mne-tools#14303) Fix bug with lite backend closing (mne-tools#14302) Fix for NumPy eig change [circle deploy] (mne-tools#14300) No PyQt5 [circle deploy] [skip azp] [skip actions] ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150) FIX: Ver [circle deploy] [skip azp] [skip actions] Hotfix fix EDF round-trip (mne-tools#14296) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291)
* upstream/main: (91 commits) Fix static doc viewing in IDEs (mne-tools#14195) Fix COLA for odd sizes (mne-tools#14312) add type hints to mne/_fiff/ module (mne-tools#14278) ENH: wire the JupyterLite build into the docs (JupyterLite split 5/5) (mne-tools#14157) MAINT: Update pre-commit hook versions (mne-tools#14306) Small documentation fix for "Frequency and time-frequency sensor analysis" tutorial (mne-tools#14304) FIX: don't mutate cached ICA sources in plot_sources properties (mne-tools#14303) Fix bug with lite backend closing (mne-tools#14302) Fix for NumPy eig change [circle deploy] (mne-tools#14300) No PyQt5 [circle deploy] [skip azp] [skip actions] ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150) FIX: Ver [circle deploy] [skip azp] [skip actions] Hotfix fix EDF round-trip (mne-tools#14296) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] ...
closes #13201
Will self-review momentarily to guide review.