mne.compute_raw_covariance

mne.compute_raw_covariance(raw, tmin=None, tmax=None, tstep=0.2, reject=None, flat=None, picks=None, verbose=None)

Estimate noise covariance matrix from a continuous segment of raw data.

It is typically useful to estimate a noise covariance from empty room data or time intervals before starting the stimulation.

Note: To speed up the computation you should consider preloading raw data by setting preload=True when reading the Raw data.

Parameters:

raw : instance of Raw

Raw data

tmin : float | None (default None)

Beginning of time interval in seconds

tmax : float | None (default None)

End of time interval in seconds

tstep : float (default 0.2)

Length of data chunks for artefact rejection in seconds.

reject : dict | None (default 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 (default 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.

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

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

verbose : bool | str | int | None (default None)

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

Returns:

cov : instance of Covariance

Noise covariance matrix.

See also

compute_covariance
Estimate noise covariance matrix from epochs