mne_denoise.dss.compute_dss#
- mne_denoise.dss.compute_dss(covariance_baseline: ndarray, covariance_biased: ndarray, *, n_components: int | None = None, rank: int | None = None, reg: float = 1e-09, verbose: bool | str | int | None = None) tuple[ndarray, ndarray, ndarray][source]#
Compute DSS spatial filters from baseline and biased covariances.
- Parameters:
- covariance_baselinendarray, shape (n_channels, n_channels)
Baseline covariance defining the total-power metric.
- covariance_biasedndarray, shape (n_channels, n_channels)
Biased covariance defining the signal-of-interest metric.
- n_componentsint or None, default=None
Number of components to return.
Nonereturns the available rank.- rankint or None, default=None
Whitening rank.
Noneestimates the rank from the baseline covariance.- regfloat, default=1e-9
Relative eigenvalue threshold used during whitening.
- verbosebool, str, int, or None, default=None
MNE-style logging level.
- Returns:
- filtersndarray, shape (n_components, n_channels)
DSS spatial filters.
- patternsndarray, shape (n_channels, n_components)
DSS spatial patterns.
- eigenvaluesndarray, shape (n_components,)
Biased-to-baseline variance ratios.
See also
DSSEstimator that learns and applies the decomposition to recordings.
Notes
The baseline covariance is whitened, the biased covariance is diagonalized in that space, and the resulting filters are normalized in the baseline metric. This implementation follows the linear DSS formulation [1].
References
Examples
>>> import numpy as np >>> from mne_denoise.dss import compute_dss >>> rng = np.random.default_rng(0) >>> data = rng.standard_normal((8, 2000)) >>> biased_data = data + 0.1 * rng.standard_normal(data.shape) >>> baseline = np.cov(data) >>> biased = np.cov(biased_data) >>> filters, patterns, scores = compute_dss(baseline, biased, n_components=3)