Repository navigation
MAINT: Replace internal EEG sample-reading helper with mffpy - #13973
Merged
scott-huberty merged 8 commits intoJun 29, 2026
Merged
Conversation
Replaces the manual binary block-reading loop in `_read_segment_file` with `mffpy.Reader.get_physical_samples_from_epoch`, adding two helpers: `_get_mff_reader` (opens reader with GCAL disabled to avoid double-scaling against MNE's existing `cals` pipeline) and `_disk_range_to_epochs` (maps a contiguous on-disk sample range across acquisition-skip gaps to per-epoch mffpy `(t0, dt)` windows). PNS reading is unchanged.
19 tasks done
PragnyaKhandelwal
added a commit
to PragnyaKhandelwal/mne-python
that referenced
this pull request
Jun 22, 2026
PragnyaKhandelwal
force-pushed
the
egi-mff-data-reader
branch
from
June 22, 2026 11:18
09b8d79 to
6987380
Compare
PragnyaKhandelwal
marked this pull request as ready for review
June 22, 2026 13:59
PragnyaKhandelwal
requested review from
agramfort,
drammock and
larsoner
as code owners
June 22, 2026 13:59
This was referenced Jun 26, 2026
scott-huberty
enabled auto-merge (squash)
June 29, 2026 17:08
Contributor
|
LGTM @PragnyaKhandelwal !! >95% test coverage 🚀 ! I edited the docstring you wrote for the private |
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 (if any)
Part ofTowards #13926.Builds on #13932 and #13945 . This is the third micro-PR in the series.
What does this implement/fix?
Replaces the internal binary-block EEG sample reader in
RawMff._read_segment_filewithmffpy.Reader.get_physical_samples_from_epoch().Two helpers are added:
_get_mff_reader(mff_path)— opens anmffpy.Readerwith its default EEG calibration (GCAL) disabled. MNE'scalsvector already incorporates that gain (set in_get_eeg_calibration_info), so leaving it enabled would double-scale every EEG sample._disk_range_to_epochs(egi_info, disk_start, disk_stop)— translates a contiguous range of on-disk sample indices (howBaseRawaddresses data) into per-epoch(t0, dt)windows (howmffpyaddresses data). EGI MFF stores signal blocks back-to-back on disk; recording-pause gaps only appear in the logical sample timeline exposed to users.The ~50-line manual
fid.seek/np.fromfile/ block-header parsing loop (_block_r) is removed and replaced with a short loop overget_physical_samples_from_epoch(), consistent with how PNS reading alreadyworks downstream.
mff_pathis stored inegi_infoatRawMff.__init__time so the reader can be instantiated on demand inside_read_segment_file.Additional information
All existing tests in
mne/io/egi/tests/test_egi.pypass locally, including multi-epoch, paused-recording, PNS, crop, and preload variants. No new test fixtures are needed — the existing.mfffiles already exercise multi-block reads and epoch boundaries.