create_windows_from_events(concat_ds, trial_start_offset_samples, trial_stop_offset_samples, window_size_samples=None, window_stride_samples=None, drop_last_window=False, mapping=None, preload=False, drop_bad_windows=True)¶
Windower that creates windows based on events in mne.Raw.
The function fits windows of window_size_samples in trial_start_offset_samples to trial_stop_offset_samples separated by window_stride_samples. If the last window does not end at trial_stop_offset_samples, it creates another overlapping window that ends at trial_stop_offset_samples if drop_last_window is set to False.
in mne: tmin (s) trial onset onset + duration (s) trial: |--------------------------------|——————————–| here: trial_start_offset_samples trial_stop_offset_samples
- concat_ds: BaseConcatDataset
a concat of base datasets each holding raw and description
- trial_start_offset_samples: int
start offset from original trial onsets in samples
- trial_stop_offset_samples: int
stop offset from original trial stop in samples
- window_size_samples: int
- 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
- mapping: dict(str: int)
mapping from event description to target value
- preload: bool
if True, preload the data of the Epochs objects.
- drop_bad_windows: bool
If True, call .drop_bad() on the resulting mne.Epochs object. This step allows identifying e.g., windows that fall outside of the continuous recording. It is suggested to run this step here as otherwise the BaseConcatDataset has to be updated as well.
- windows_ds: WindowsDataset
Dataset containing the extracted windows.