MAINT: Replace manual PNS binary block reader in _read_segment_file with mffpy#14030
Open
PragnyaKhandelwal wants to merge 4 commits into
Open
MAINT: Replace manual PNS binary block reader in _read_segment_file with mffpy#14030PragnyaKhandelwal wants to merge 4 commits into
_read_segment_file with mffpy#14030PragnyaKhandelwal wants to merge 4 commits into
Conversation
… with `mffpy`-backed reading via `get_physical_samples_from_epoch`
18 tasks
Contributor
Author
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 of #13926 (Phase 2 — PNS binary block reader migration).
What does this implement/fix?
Replaces the ~65-line manual binary PNS block reader in
RawMff._read_segment_file(built around
_block_r/np.fromfileloops) withmffpy-backed reading viaget_physical_samples_from_epoch(channels=["PNSData"]), consistent with how EEGdata has already been read since #13932.
Key changes:
_disk_range_to_epochs+ mffpy epochwindow mechanism used for EEG, removing ~65 lines of manual seek/read logic.
_block_ris no longer imported intoegimff.py(it remains ingeneral.pywhere it is still used for PNS header validation in
_read_mff_header).sample than EEG in the last block) is handled with
cols[:pns_chunk.shape[1]],matching the intent of the previous
samples_to_read == 1guard.Additional information
I used Claude Sonnet 4.6 to assist with diagnosing two bugs caught during testing
(a missing
_mult_cal_onecalibration call and the PSG shape mismatch). I reviewed,understood, and tested all changes myself.