Add optional edfio parsing engine to read_raw_edf - #14215
Closed
bruAristimunha wants to merge 4 commits into
Closed
Conversation
bruAristimunha
force-pushed
the
pr/4-edfio-engine
branch
from
August 25, 2026 08:07
15ef38d to
72f60ec
Compare
This was referenced Aug 25, 2026
bruAristimunha
force-pushed
the
pr/4-edfio-engine
branch
2 times, most recently
from
August 25, 2026 08:53
8cee597 to
f7e28f9
Compare
get_data resolves picks=None to arange directly instead of going through string-based channel-name machinery on every call; _picks_to_idx gets an early return for integer arrays already unique and in range (duplicate picks keep taking the validating path); _mult_cal_one fuses gather, type-cast, and calibration into a single elementwise pass.
FIF raw segments are read as byte-offset views into a PID-keyed memory map of the file instead of open/seek/read per call; buffer entries are selected with searchsorted on the sorted bounds. gzip, file-like objects, and non-simple tag types keep the legacy path. The generic memory-map cache in _read_segments_file also serves the other binary readers.
Uniform-sampling-rate EDF/BDF windows decode through a strided gather plus an optional-numba kernel writing calibrated samples directly into the caller's output buffer, replacing the per-channel Python loop. Big-endian chunks are byteswapped to native order first; uniform stim channels apply the legacy truncating bitmask on the fast path; projector/compensation reads keep the exact legacy route. EDF/BDF/GDF file handles persist per process (PID-keyed LRU).
engine='edfio' parses EDF via the optional edfio package into a preloaded Raw (uniform sampling rates; all channels EEG; no meas_date). Decoding stacks digital samples once and applies calibration in two fused passes; output matches the native engine within 1 ulp.
bruAristimunha
force-pushed
the
pr/4-edfio-engine
branch
from
August 25, 2026 09:00
f7e28f9 to
30fda07
Compare
Member
|
Rather than add a backend to shave 25%, could we profile both to see where we lose speed and they do not? Is it inefficient conversion, etc.? If at the end of the day we have to allow using a different backend we can, but it would be good to understand where our time loss is. |
Member
|
Okay @bruAristimunha I think this one is next, see comment above ☝️ |
Contributor
Author
|
Superseded by #14237, which speeds up the same EDF/BDF cold path natively (236 MB EDF preload ~250 ms -> ~85 ms on my machine, interleaved A/B against a pristine |
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)
None. Part 4/5 of the IO-speedup series. Depends on #14214 (→ #14213 → #14212).
What does this implement/fix?
Adds
engine="mne" | "edfio"toread_raw_edf. The edfio engine parses viathe optional edfio package into a preloaded Raw. Minimal scope: uniform
sampling rates only, all channels EEG,
meas_dateunset.Full load of a 236 MB EDF: native ~453 ms → edfio ~368 ms.
Related upstream change: the-siesta-group/edfio#114 (public scaling factors).
Additional information
AI disclosure: same as #14212.
CI note: held until the parent PR merges.