braindecode.datasets.TUHEvents#

class braindecode.datasets.TUHEvents(path, recording_ids=None, target_name=None, preload=False, add_physician_reports=False, rename_channels=False, set_montage=False, channel_events=False, merge_events=True, on_missing_files='raise', version='v2.0.1', n_jobs=1)[source]#

Temple University Hospital (TUH) EEG Event Corpus.

Event annotations are read from the .rec file beside each EDF recording and stored in its raw.annotations.

The dataset layout follows the TUH EEG Event Corpus structure (train/eval folders) as documented in the corpus README.

see https://isip.piconepress.com/projects/nedc/html/tuh_eeg/index.shtml#c_tuev

The event names are mapped as follows:

  • ‘1’ -> ‘spsw’ (spike and slow wave)

  • ‘2’ -> ‘gped’ (generalized periodic epileptiform discharge)

  • ‘3’ -> ‘pled’ (periodic lateralized epileptiform discharge)

  • ‘4’ -> ‘eyem’ (eye movement)

  • ‘5’ -> ‘artf’ (artifact)

  • ‘6’ -> ‘bckg’ (background)

Parameters:
  • path (str) – Parent directory of the dataset.

  • recording_ids (list[int] | None) – A (list of) int of recording id(s) to be read (order matters and will overwrite default chronological order, e.g. if recording_ids=[1,0], then the first recording returned by this class will be chronologically later then the second recording. Provide recording_ids in ascending order to preserve chronological order.).

  • target_name (str | tuple[str, ...] | None) – Can be ‘gender’, ‘age’, or None. Use None when using events labels as target.

  • preload (bool) – If True, preload the data of the Raw objects.

  • add_physician_reports (bool) – If True, the physician reports will be read from disk and added to the description.

  • rename_channels (bool) – If True, rename the EEG channels to the standard 10-05 system.

  • set_montage (bool) – If True, set the montage to the standard 10-05 system.

  • channel_events (bool) – If True, each .rec channel index selects a name in raw.ch_names. This requires the EDF channels to match the annotation montage, including its bipolar derivations and their order. If False, events are global and the channel index is ignored.

  • merge_events (bool) – If True, merge overlapping or touching events of the same type into a single event covering their full span.

  • on_missing_files (Literal['warn', 'raise']) – Behavior when the number of files found in the dataset directory does not match the expected number of files.

  • version (Literal['v2.0.1']) – Version of the TUH Events EEG Corpus to use. Currently only ‘v2.0.1’ is supported.

  • n_jobs (int) – Number of jobs to be used to read files in parallel.