mne.preprocessing.compute_proj_ecg

mne.preprocessing.compute_proj_ecg(raw, raw_event=None, tmin=- 0.2, tmax=0.4, n_grad=2, n_mag=2, n_eeg=2, l_freq=1.0, h_freq=35.0, average=True, filter_length='10s', n_jobs=1, ch_name=None, reject={'mag': 3e-12}, flat=None, bads=[], avg_ref=False, no_proj=False, event_id=999, ecg_l_freq=5, ecg_h_freq=35, tstart=0.0, qrs_threshold='auto', filter_method='fir', iir_params=None, copy=True, return_drop_log=False, meg='separate', verbose=None)[source]

Compute SSP/PCA projections for ECG artifacts.

Note

raw data will be loaded if it is not already.

Parameters
rawmne.io.Raw

Raw input file.

raw_eventmne.io.Raw or None

Raw file to use for event detection (if None, raw is used).

tminfloat

Time before event in seconds.

tmaxfloat

Time after event in seconds.

n_gradint

Number of SSP vectors for gradiometers.

n_magint

Number of SSP vectors for magnetometers.

n_eegint

Number of SSP vectors for EEG.

l_freqfloat | None

Filter low cut-off frequency for the data channels in Hz.

h_freqfloat | None

Filter high cut-off frequency for the data channels in Hz.

averagebool

Compute SSP after averaging. Default is True.

filter_lengthstr | int | None

Number of taps to use for filtering.

n_jobsint

The number of jobs to run in parallel (default 1). Requires the joblib package.

ch_namestr | None

Channel to use for ECG detection (Required if no ECG found).

rejectdict | None

Epoch rejection configuration (see Epochs).

flatdict | None

Epoch flat configuration (see Epochs).

badslist

List with (additional) bad channels.

avg_refbool

Add EEG average reference proj.

no_projbool

Exclude the SSP projectors currently in the fiff file.

event_idint

ID to use for events.

ecg_l_freqfloat

Low pass frequency applied to the ECG channel for event detection.

ecg_h_freqfloat

High pass frequency applied to the ECG channel for event detection.

tstartfloat

Start artifact detection after tstart seconds.

qrs_thresholdfloat | str

Between 0 and 1. qrs detection threshold. Can also be “auto” to automatically choose the threshold that generates a reasonable number of heartbeats (40-160 beats / min).

filter_methodstr

Method for filtering (‘iir’ or ‘fir’).

iir_paramsdict | None

Dictionary of parameters to use for IIR filtering. See mne.filter.construct_iir_filter for details. If iir_params is None and method=”iir”, 4th order Butterworth will be used.

copybool

If False, filtering raw data is done in place. Defaults to True.

return_drop_logbool

If True, return the drop log.

New in version 0.15.

megstr

Can be ‘separate’ (default) or ‘combined’ to compute projectors for magnetometers and gradiometers separately or jointly. If ‘combined’, n_mag == n_grad is required and the number of projectors computed for MEG will be n_mag.

New in version 0.18.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). If used, it should be passed as a keyword-argument only.

Returns
projlist

Computed SSP projectors.

ecg_eventsndarray

Detected ECG events.

drop_loglist

The drop log, if requested.

Notes

Filtering is applied to the ECG channel while finding events using ecg_l_freq and ecg_h_freq, and then to the raw instance using l_freq and h_freq before creation of the epochs used to create the projectors.