mne.preprocessing.create_ecg_epochs

mne.preprocessing.create_ecg_epochs(raw, ch_name=None, event_id=999, picks=None, tmin=-0.5, tmax=0.5, l_freq=8, h_freq=16, reject=None, flat=None, baseline=None, preload=True, keep_ecg=False, verbose=None)

Conveniently generate epochs around ECG artifact events

Parameters:

raw : instance of Raw

The raw data

ch_name : None | str

The name of the channel to use for ECG peak detection. If None (default), a synthetic ECG channel is created from cross channel average. Synthetic channel can only be created from ‘meg’ channels.

event_id : int

The index to assign to found events

picks : array-like of int | None (default)

Indices of channels to include (if None, all channels are used).

tmin : float

Start time before event.

tmax : float

End time after event.

l_freq : float

Low pass frequency.

h_freq : float

High pass frequency.

reject : dict | None

Rejection parameters based on peak-to-peak amplitude. Valid keys are ‘grad’ | ‘mag’ | ‘eeg’ | ‘eog’ | ‘ecg’. If reject is None then no rejection is done. Example:

reject = dict(grad=4000e-13, # T / m (gradiometers)
              mag=4e-12, # T (magnetometers)
              eeg=40e-6, # uV (EEG channels)
              eog=250e-6 # uV (EOG channels)
              )

flat : dict | None

Rejection parameters based on flatness of signal. Valid keys are ‘grad’ | ‘mag’ | ‘eeg’ | ‘eog’ | ‘ecg’, and values are floats that set the minimum acceptable peak-to-peak amplitude. If flat is None then no rejection is done.

baseline : tuple or list of length 2, or None

The time interval to apply rescaling / baseline correction. If None do not apply it. If baseline is (a, b) the interval is between “a (s)” and “b (s)”. If a is None the beginning of the data is used and if b is None then b is set to the end of the interval. If baseline is equal ot (None, None) all the time interval is used. If None, no correction is applied.

preload : bool

Preload epochs or not.

keep_ecg : bool

When ECG is synthetically created (after picking), should it be added to the epochs? Defaults to False.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose).

Returns:

ecg_epochs : instance of Epochs

Data epoched around ECG r-peaks.