regular.create_regular_epochs#

autoclean.functions.epoching.regular.create_regular_epochs(data, tmin=-1.0, tmax=1.0, duration=None, overlap=0.0, baseline=None, reject=None, flat=None, reject_by_annotation=True, include_metadata=True, preload=True, verbose=None)[source]#

Create regular fixed-length epochs from continuous EEG data.

This function creates epochs of fixed length at regular intervals throughout the continuous EEG recording. This approach is particularly useful for resting-state data or when analyzing ongoing brain activity without specific event markers.

The function automatically generates events at regular intervals and creates epochs around these synthetic events. Optionally, it can include information about annotations that fall within each epoch as metadata.

Parameters:
datamne.io.BaseRaw

The continuous EEG data to create epochs from.

tminfloat, default -1.0

Start time of the epoch relative to the synthetic event in seconds. Negative values start before the event.

tmaxfloat, default 1.0

End time of the epoch relative to the synthetic event in seconds. Positive values extend after the event.

durationfloat or None, default None

Duration of each epoch in seconds. If None, calculated as tmax - tmin. This parameter provides an alternative way to specify epoch length.

overlapfloat, default 0.0

Overlap between consecutive epochs in seconds. Zero means no overlap. Positive values create overlapping epochs for increased data yield.

baselinetuple of (float, float) or None, default None

Time interval for baseline correction in seconds relative to epoch start. For example, (None, 0) uses the entire pre-stimulus period, (-0.2, 0) uses 200ms before stimulus. None applies no baseline correction.

rejectdict or None, default None

Rejection thresholds for different channel types in volts. Example: {‘eeg’: 100e-6, ‘eog’: 200e-6}. Epochs exceeding these thresholds will be marked as bad and potentially dropped.

flatdict or None, default None

Rejection thresholds for flat channels in volts (minimum required range). Example: {‘eeg’: 1e-6}. Channels with signal range below threshold in any epoch will cause epoch rejection.

reject_by_annotationbool, default True

Whether to automatically reject epochs that overlap with ‘bad’ annotations. If False, epochs are marked but not dropped automatically.

include_metadatabool, default True

Whether to include metadata about annotations and events that fall within each epoch. Useful for post-hoc analysis and quality control.

preloadbool, default True

Whether to preload epoch data into memory. Recommended for most use cases to enable all epoch manipulation functions.

verbosebool or None, default None

Control verbosity of output. If None, uses MNE default.

Returns:
epochsmne.Epochs

The created epochs object with metadata about contained events and annotations (if include_metadata=True).

See also

create_eventid_epochs

Create epochs based on specific events

create_sl_epochs

Create statistical learning epochs

mne.make_fixed_length_events

Generate events for fixed-length epochs

mne.Epochs

MNE epochs class

Examples

>>> epochs = create_regular_epochs(raw, tmin=-1.0, tmax=1.0)
>>> epochs = create_regular_epochs(raw, overlap=1.0, reject={'eeg': 100e-6})