mne.cov.compute_whitener(noise_cov, info=None, picks=None, rank=None, scalings=None, return_rank=False, pca=False, return_colorer=False, verbose=None)[source]

Compute whitening matrix.


The noise covariance.

infodict | None

The measurement info. Can be None if noise_cov has already been prepared with prepare_noise_cov().

picksstr | list | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values “all” to pick all channels, or “data” to pick data channels. None (default) will pick good data channels(excluding reference MEG channels).

rankNone | dict | ‘info’ | ‘full’

This controls the rank computation that can be read from the measurement info or estimated from the data. See Notes of mne.compute_rank() for details.The default is None.

New in version 0.18: Support for ‘info’ mode.

scalingsdict | None

The rescaling method to be applied. See documentation of prepare_noise_cov for details.


If True, return the rank used to compute the whitener.

New in version 0.15.

pcabool | str

Space to project the data into. Options:


Whitener will be shape (n_nonzero, n_channels).


Whitener will be shape (n_channels, n_channels), potentially rank deficient, and have the first n_channels - n_nonzero rows and columns set to zero.

False (default)

Whitener will be shape (n_channels, n_channels), potentially rank deficient, and rotated back to the space of the original data.

New in version 0.18.


If True, return the colorer as well.

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.

Wndarray, shape (n_channels, n_channels) or (n_nonzero, n_channels)

The whitening matrix.


The channel names.


Rank reduction of the whitener. Returned only if return_rank is True.

colorerndarray, shape (n_channels, n_channels) or (n_channels, n_nonzero)

The coloring matrix.

Examples using mne.cov.compute_whitener