ENH: replace _get_blocks binary reader with mffpy Reader API#14043
Conversation
for more information, see https://pre-commit.ci
|
Test failure seems unrelated @scott-huberty....
|
_get_blocks binary reader with mffpy Reader API
Yep, see scikit-learn/scikit-learn#34458 . One of our CI's tests against the latest builds of Numpy, spicy, scikit etc. (so that we can catch bugs early), and a recent build of scikit-learn has not been published to the archive in a month or so. |
Thanks for the information ))!! |
|
All checks are passing now @scott-huberty! |
scott-huberty
left a comment
There was a problem hiding this comment.
It's awesome seeing all the LOC we get to delete when offloading the work to mffpy!
yep completely agree... |
* upstream/main: Make scrollbar handlers draggable (mne-tools#14040) [pre-commit.ci] pre-commit autoupdate (mne-tools#14052) Warn when Epochs events fall outside the raw data range (mne-tools#12989) (mne-tools#14004) Ensure epochs being concatenated have compatible event ids (mne-tools#14051) Widen main content area (mne-tools#14015) MAINT: remove dead gain/bits/value_range fields from _read_header in … (mne-tools#14047) ENH: replace `_get_blocks` binary reader with mffpy Reader API (mne-tools#14043) MAINT: Update dependency specifiers (mne-tools#14048) [dependabot]: Bump the actions group with 2 updates (mne-tools#14049) Simplify doc building with more refleak (mne-tools#14045) ENH: add overlay Brain GUI (mne-tools#14031) ENH: support multiple simultaneous overlays in Brain.add_data (mne-tools#13995) Add option to show a zero line in browser (mne-tools#14018) FIX: pass cmap name string not tuple to interactive topomap slider kwargs (mne-tools#14039) Doc/add ai policy pointer (mne-tools#14037) Allow subclasses of FigureClass to be passed to plot_raw/plot_epochs (mne-tools#13979) MAINT: Replace manual PNS binary block reader in `_read_segment_file` with `mffpy` (mne-tools#14030)
* upstream/main: (206 commits) Improve type checks (mne-tools#14036) Make scrollbar handlers draggable (mne-tools#14040) [pre-commit.ci] pre-commit autoupdate (mne-tools#14052) Warn when Epochs events fall outside the raw data range (mne-tools#12989) (mne-tools#14004) Ensure epochs being concatenated have compatible event ids (mne-tools#14051) Widen main content area (mne-tools#14015) MAINT: remove dead gain/bits/value_range fields from _read_header in … (mne-tools#14047) ENH: replace `_get_blocks` binary reader with mffpy Reader API (mne-tools#14043) MAINT: Update dependency specifiers (mne-tools#14048) [dependabot]: Bump the actions group with 2 updates (mne-tools#14049) Simplify doc building with more refleak (mne-tools#14045) ENH: add overlay Brain GUI (mne-tools#14031) ENH: support multiple simultaneous overlays in Brain.add_data (mne-tools#13995) Add option to show a zero line in browser (mne-tools#14018) FIX: pass cmap name string not tuple to interactive topomap slider kwargs (mne-tools#14039) Doc/add ai policy pointer (mne-tools#14037) Allow subclasses of FigureClass to be passed to plot_raw/plot_epochs (mne-tools#13979) MAINT: Replace manual PNS binary block reader in `_read_segment_file` with `mffpy` (mne-tools#14030) Fix transition bandwidth reported in 'filter too short' error (mne-tools#11406) (mne-tools#14005) ENH: Show the current time as a vertical line in plot_evoked_topo (mne-tools#14032) ...

Reference issue (if any)
Phase 2 of #13926
What does this implement/fix?
_get_blocksingeneral.pymanually parsed the EGI binary signalfile block-by-block to extract sample counts, channel count, and
sampling rate. This duplicates functionality that mffpy already provides
through its
ReaderAPI.This PR replaces both the EEG and PNS calls to
_get_blocksin_read_mff_headerwithmffpy.Reader, which is already a dependency:reader.num_channels["EEG"]→ replaces manualn_channelsparsingreader.sampling_rates["EEG"]→ replaces manualsfreqparsingreader.block_sample_counts["EEG"]→ replacessamples_blockfor EEGreader.block_sample_counts["PNSData"]→ replacessamples_blockfor PNSThe same
Readerinstance (created once from the MFF directory) coversboth EEG and PNS, so no extra I/O is added.
_get_blocksis no longerimported in
egimff.pyas a result.The imports inside
_read_mff_headerfollow the existing lazy-importpattern:
_soft_importas a pre-check, then specificfrom mffpy import Readerandfrom mffpy.xml_files import XML.Additional information