Denoising Source Separation (DSS) algorithms for MNE-Python.
mne-denoise provides robust Denoising Source Separation (DSS) techniques to the Python MNE ecosystem. It specializes in extracting signals of interest (evoked responses, oscillations) by leveraging data structure (reproducibility across trials) rather than just variance.
- Linear DSS: Isolate components based on reproducibility across trials (evoked response) or characteristic frequencies.
- Nonlinear / Iterative DSS: Powerful separation for complex non-Gaussian sources.
- Spectrogram & Temporal DSS: Specialized denoisers for time-frequency targets.
- MNE Integration: Fit and transform directly on
mne.Raw,mne.Epochs, andmne.Evokedobjects. - Scikit-Learn API: Fully compatible
Estimatorinterface (fit,transform,inverse_transform).
Install via pip:
pip install mne-denoiseOr install from source:
pip install "git+https://github.com/mne-tools/mne-denoise.git"DSS finds spatial filters that maximize the ratio of "reproducible" (evoked) power to total power.
from mne_denoise.dss import DSS, TrialAverageBias
import mne
# Load epochs
epochs = mne.read_epochs("sample_epochs.fif")
# Define our "bias": we want components that are consistent across trials
bias = TrialAverageBias()
# Initialize and fit DSS
dss = DSS(bias=bias, n_components=5)
# Fits regular DSS on the epochs data
dss.fit(epochs)
# 1. Extract the clean components (sources)
sources = dss.transform(epochs, return_type="sources")
# 2. Or reconstruct sensor data using only the best components
cleaned_epochs = dss.transform(epochs, return_type="epochs")Extract specific rhythms (e.g. Alpha, Beta) by maximizing power in a frequency band.
from mne_denoise.dss import BandpassBias
# Define a bandpass bias (8-12 Hz)
bias = BandpassBias(sfreq=epochs.info['sfreq'], freq=10, bandwidth=4)
dss_alpha = DSS(bias=bias, n_components=3)
dss_alpha.fit(epochs)
# Extract alpha components
alpha_sources = dss_alpha.transform(epochs, return_type="sources")Full documentation is available at https://mne-tools.github.io/mne-denoise/.
We welcome contributions! Please check CONTRIBUTING.md for guidelines.
DSS (Linear/Nonlinear):
Särelä, J., & Valpola, H. (2005). Denoising source separation. Journal of Machine Learning Research, 6, 233-272.
de Cheveigné, A., & Simon, J. Z. (2008). Denoising based on spatial filtering. Journal of Neuroscience Methods, 171(2), 331-339.
BSD 3-Clause License. See LICENSE for details.