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) makes datetime.replace raise ValueError: second must be in 0..59 after the date was read, so the whole file is refused. MNE already reads a file whose start date is invalid, with meas_date unset 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 (on003343: 20 signals, which take 5376 bytes, in a 4608-byte header) fails a bare assert. The file is still refused, now with a ValueError that says why (“Bad EDF/BDF header: …”), which EEGDash reports as a data integrity error instead of retrying without the events files.

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() under fixes().

eegdash.io.edf.read_raw_edf(input_fname, **kwargs)[source]

Read an EDF file with mne.io.read_raw_edf() under fixes().