eegdash.io.eeglab module#

MNE’s EEGLAB reader, tolerant of two struct layouts real deposits have.

Each fix wraps one helper of mne/io/eeglab/eeglab.py (MNE 1.13, unchanged on main as of 2026-10-15) and is the diff proposed upstream (upstream/eeglab.md):

  • A chanlocs field empty on every channel comes back from pymatreader as one empty array, not one per channel (on004166: chanlocs.type and .ref). _dol_to_lod then raises IndexError or, when the empty field happens to come first, returns no channels at all (default names EEG 000 …).

  • Events without a type field (on008496: one event, latency only) break _read_annotations_eeglab; they get the description "n/a".

  • Events with an empty latency (on004350: a trailing event with every field empty) make np.array(EEG.event.latency) ragged, and events before the first sample (on004851: latency -1.3e9) make _check_latencies raise although set_annotations has already cropped them away. Both are dropped with a warning, as EEGLAB’s eeg_checkset drops out-of-range events.

One more fix picks the data file at read time (_check_load_mat). It replaces EEGDash’s old rewrite of the cached .set (savemat), which made every new session download the .set again and let a second process read it half written. When EEG.data names another file than <set stem>.fdt while that file exists, the own .fdt is read. MNE trusts EEG.data whenever the file it names exists, and on004348 has 7 *_task-wake_eeg.set that name the same subject’s *_task-sleep_eeg.fdt. (MNE already falls back to the own .fdt when the named one is missing.)

eegdash.io.eeglab.fixes()[source]

Patch MNE’s EEGLAB helpers while reading.

eegdash.io.eeglab.own_data_file(set_fname, dataname)[source]

Return the .fdt to read for set_fname whose EEG.data is dataname.

<set stem>.fdt when it exists, else the file EEG.data names (which may not exist). A dataname that is the .set itself (samples stored in the .set) is kept.

eegdash.io.eeglab.read_raw_eeglab(input_fname, **kwargs)[source]

Read an EEGLAB file with mne.io.read_raw_eeglab() under fixes().