mne.cov.regularize

mne.cov.regularize(cov, info, mag=0.1, grad=0.1, eeg=0.1, exclude='bads', proj=True, seeg=0.1, ecog=0.1, hbo=0.1, hbr=0.1, verbose=None)[source]

Regularize noise covariance matrix.

This method works by adding a constant to the diagonal for each channel type separately. Special care is taken to keep the rank of the data constant.

Note

This function is kept for reasons of backward-compatibility. Please consider explicitly using the method parameter in mne.compute_covariance() to directly combine estimation with regularization in a data-driven fashion. See the faq for more information.

Parameters:
cov : Covariance

The noise covariance matrix.

info : dict

The measurement info (used to get channel types and bad channels).

mag : float (default 0.1)

Regularization factor for MEG magnetometers.

grad : float (default 0.1)

Regularization factor for MEG gradiometers.

eeg : float (default 0.1)

Regularization factor for EEG.

exclude : list | ‘bads’ (default ‘bads’)

List of channels to mark as bad. If ‘bads’, bads channels are extracted from both info[‘bads’] and cov[‘bads’].

proj : bool (default true)

Apply or not projections to keep rank of data.

seeg : float (default 0.1)

Regularization factor for sEEG signals.

ecog : float (default 0.1)

Regularization factor for ECoG signals.

hbo : float (default 0.1)

Regularization factor for HBO signals.

hbr : float (default 0.1)

Regularization factor for HBR signals.

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

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

Returns:
reg_cov : Covariance

The regularized covariance matrix.