braindecode.datasets.create_from_mne_epochs#

braindecode.datasets.create_from_mne_epochs(list_of_epochs, window_size_samples, window_stride_samples, drop_last_window, descriptions=None, mapping=None, preload=False, picks=None, drop_bad_windows=True)[source]#

Create WindowsDatasets from mne.Epochs.

Parameters:
  • list_of_epochs (list[BaseEpochs]) – list of mne.Epochs

  • window_size_samples (int) – window size

  • window_stride_samples (int) – stride between windows

  • drop_last_window (bool) – whether or not have a last overlapping window, when windows do not equally divide the continuous signal

  • descriptions (list[dict | Series] | None) – list of dicts or pandas.Series with additional information about the epochs. If None, no description is added. Length must match list_of_epochs. Each description is applied to all windows generated from the corresponding Epochs object.

  • mapping (dict[str | int, int] | None) – Mapping from event description to target value. Keys can be integers (matching epochs.events[:, 2]) or their string representations. If None, targets are set to the raw integer event codes. If a mapping is provided and an event code is not found in the mapping, the original event code is kept as-is.

  • preload (bool) – if True, preload the data of the Epochs objects.

  • picks (str | list | slice | None) – channels to include. If None, all available channels are used.

  • drop_bad_windows (bool) – If True, call .drop_bad() on the resulting mne.Epochs object. This allows identifying windows that fall outside of the valid signal range. Defaults to True.

Returns:

windows_datasets – X and y transformed to a dataset format that is compatible with skorch and braindecode

Return type:

BaseConcatDataset

Examples using braindecode.datasets.create_from_mne_epochs#

MNE Dataset Example

MNE Dataset Example