eegdash.io.bids module#
MNE-BIDS’s read_raw_bids, tolerant of two sidecar layouts real deposits have.
Each fix patches one global of MNE-BIDS 0.20 (read.py, tsv_handler.py; unchanged on
main 085e309 as of 2026-10-18); the upstream PRs are still to be written:
RecordingType: "epoched"on a continuous container (.vhdr,.edf,.bdf):read_raw_bidsrefuses the file and points toread_epochs_bids, which slices it withEpochLengthand fails on most real events.tsv files (noEpochLength, stimulus rows, empty or non-integer events). The file on disk is continuous, so it is read as Raw; events.tsv still becomes annotations. Only.setwith trials is refused.An events.tsv column named after a reserved
mne.Annotationskey (descriptionin nm000536) makes the extras raiseValueError; the column is kept asevents_<name>.A negative events.tsv
duration(on004703: -16.35 s) trips an assertion inmne.Annotations.crop; it becomes 0 and a warning is logged.A participants.tsv
agethat is not an age in years (nm000149: the year 2018) puts the birthday,meas_date - age, before year 1:OverflowError. The birthday is left unset, as MNE-BIDS does whenmeas_dateis unknown; the other participant fields are kept.A TSV that is not UTF-8 (on004588 sub-S37 events.tsv): MNE-BIDS checks only the first 64 KiB for UTF-8 and otherwise reads latin-1, so a later non-UTF-8 byte raises
UnicodeDecodeError, and cp1252 characters (–,€,’) come back as control characters. The whole file is checked, and cp1252 is tried before latin-1. This replaces EEGDash’s rewrite of the cached TSV to UTF-8, which made every new session download it again.A reader that drops a recording’s leading samples (
mef.py: on004624’s neural channels start 0.1-0.2 s after its aux channels) setsraw._eegdash_lead_s; events.tsv onsets, counted from the earliest start, are moved back by as much so they stay on the same samples.
Several space- electrodes files matching a recording equally well (nm000485
space-Other and space-Talairach) make MNE-BIDS read no positions, and
BIDSPath(space=) would rename the data file too. The electrodes and
coordsystem lookups then take one space: a named coordinate system before
Other, then alphabetical. Positions are never merged across spaces.
without_events() reads a recording as if it had no events.tsv, for an
events file MNE-BIDS cannot turn into annotations. Only reads in the calling
thread are affected; nothing in the dataset folder is renamed, so other runs
read in parallel keep their own events.
- eegdash.io.bids.fixes()[source]
Patch MNE-BIDS’s reader globals while reading.
- eegdash.io.bids.tsv_encoding(fname)[source]
Return the encoding to read the TSV
fnamewith (UTF-8, else cp1252, else latin-1).Replaces
mne_bids.tsv_handler._detect_file_encodingwhile reading.
- eegdash.io.bids.without_events()[source]
Make
read_raw_bidsin this thread (or task) skip the events sidecars.