eegdash.io.edf module#
MNE’s EDF/BDF reader, tolerant of an invalid start time, explicit about a bad header.
The fixes wrap _read_edf_header of mne/io/edf/edf.py (MNE 1.13, unchanged
on main as of 2026-10-18); the upstream PR is still to be written:
A start time with 60 seconds (
10.47.60: on003555, on003775, on004381, on004752) makesdatetime.replaceraiseValueError: second must be in 0..59after the date was read, so the whole file is refused. MNE already reads a file whose start date is invalid, withmeas_dateunset and the warning “Invalid measurement date encountered in the header.”; an invalid start time now goes the same way. No date or time is made up.A header whose header-size field disagrees with its number of signals fails a bare
assert. on003343 (59 BDF): 20 signals take 5376 bytes, the field says 4608 (or 4352), and the file size is exactly field + n_records x record size: the writer put the data at the field’s offset, then wrote the full header over its first 768 (1024) bytes. MNE already reads the data from the field’s offset; it gets the header with the field corrected, in memory, and the samples of the first channel under the header are annotatedBAD_header_overlap(kept byread_raw_bids), with an eegdash warning. Any other mismatch is refused with aValueErrorthat says why (“Bad EDF/BDF header: …”). Nothing is written; once the deposit has a correct header (nemarDatasets/on003343#3) this path is not taken.MNE scales a channel by its header unit only for µV and mV; any other unit,
nVincluded, is read as is.nVandpVare scaled, and a channel whose header range reads beyond 1 V (a voltage) or 100 rad is reported with an eegdash warning: nm000281 stored joint angles as rad x 1e6 underrad, so MNE read them up to 2e6 rad. Nothing is changed for such a channel.
- eegdash.io.edf.fixes()[source]
Patch MNE’s EDF/BDF header reader while reading.
- eegdash.io.edf.read_raw_bdf(input_fname, **kwargs)[source]
Read a BDF file with
mne.io.read_raw_bdf()underfixes().
- eegdash.io.edf.read_raw_edf(input_fname, **kwargs)[source]
Read an EDF file with
mne.io.read_raw_edf()underfixes().