mne.forward.compute_depth_prior#

mne.forward.compute_depth_prior(forward, info, exp=0.8, limit=10.0, limit_depth_chs=False, combine_xyz='spectral', noise_cov=None, rank=None, verbose=None)[source]#

Compute depth prior for depth weighting.

Parameters
forwardinstance of Forward

The forward solution.

infomne.Info

The mne.Info object with information about the sensors and methods of measurement.

expfloat

Exponent for the depth weighting, must be between 0 and 1.

limitfloat | None

The upper bound on depth weighting. Can be None to be bounded by the largest finite prior.

limit_depth_chsbool | ‘whiten’

How to deal with multiple channel types in depth weighting. The default is True, which whitens based on the source sensitivity of the highest-SNR channel type. See Notes for details.

Changed in version 0.18: Added the “whiten” option.

combine_xyz‘spectral’ | ‘fro’

When a loose (or free) orientation is used, how the depth weighting for each triplet should be calculated. If ‘spectral’, use the squared spectral norm of Gk. If ‘fro’, use the squared Frobenius norm of Gk.

New in version 0.18.

noise_covinstance of Covariance | None

The noise covariance to use to whiten the gain matrix when limit_depth_chs='whiten'.

New in version 0.18.

rankNone | ‘info’ | ‘full’ | dict

This controls the rank computation that can be read from the measurement info or estimated from the data. When a noise covariance is used for whitening, this should reflect the rank of that covariance, otherwise amplification of noise components can occur in whitening (e.g., often during source localization).

None

The rank will be estimated from the data after proper scaling of different channel types.

'info'

The rank is inferred from info. If data have been processed with Maxwell filtering, the Maxwell filtering header is used. Otherwise, the channel counts themselves are used. In both cases, the number of projectors is subtracted from the (effective) number of channels in the data. For example, if Maxwell filtering reduces the rank to 68, with two projectors the returned value will be 66.

'full'

The rank is assumed to be full, i.e. equal to the number of good channels. If a Covariance is passed, this can make sense if it has been (possibly improperly) regularized without taking into account the true data rank.

dict

Calculate the rank only for a subset of channel types, and explicitly specify the rank for the remaining channel types. This can be extremely useful if you already know the rank of (part of) your data, for instance in case you have calculated it earlier.

This parameter must be a dictionary whose keys correspond to channel types in the data (e.g. 'meg', 'mag', 'grad', 'eeg'), and whose values are integers representing the respective ranks. For example, {'mag': 90, 'eeg': 45} will assume a rank of 90 and 45 for magnetometer data and EEG data, respectively.

The ranks for all channel types present in the data, but not specified in the dictionary will be estimated empirically. That is, if you passed a dataset containing magnetometer, gradiometer, and EEG data together with the dictionary from the previous example, only the gradiometer rank would be determined, while the specified magnetometer and EEG ranks would be taken for granted.

The default is None.

New in version 0.18.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns
depth_priorndarray, shape (n_vertices,)

The depth prior.

Notes

The defaults used by the minimum norm code and sparse solvers differ. In particular, the values for MNE are:

compute_depth_prior(..., limit=10., limit_depth_chs=True,
                    combine_xyz='spectral')

In sparse solvers and LCMV, the values are:

compute_depth_prior(..., limit=None, limit_depth_chs='whiten',
                    combine_xyz='fro')

The limit_depth_chs argument can take the following values:

  • True (default)

    Use only grad channels in depth weighting (equivalent to MNE C minimum-norm code). If grad channels aren’t present, only mag channels will be used (if no mag, then eeg). This makes the depth prior dependent only on the sensor geometry (and relationship to the sources).

  • 'whiten'

    Compute a whitener and apply it to the gain matirx before computing the depth prior. In this case noise_cov must not be None. Whitening the gain matrix makes the depth prior depend on both sensor geometry and the data of interest captured by the noise covariance (e.g., projections, SNR).

    New in version 0.18.

  • False

    Use all channels. Not recommended since the depth weighting will be biased toward whichever channel type has the largest values in SI units (such as EEG being orders of magnitude larger than MEG).