mne_denoise.dss.denoisers.SpectrogramDenoiser#
- class mne_denoise.dss.denoisers.SpectrogramDenoiser(threshold_percentile: float = 90.0, nperseg: int = 256, noverlap: int | None = None, mask: ndarray | None = None)[source]#
Adaptive/Nonlinear spectrogram denoiser (Section 4.1.3).
Applies masking in the time-frequency domain. This version is ADAPTIVE, calculating the mask from the source estimate itself at each iteration. This makes it distinct from the Linear SpectrogramBias.
- Parameters:
threshold_percentile (float) – For adaptive masking, threshold below this percentile. Default 90. Higher percentile = sparser signal (more aggressive denoising).
nperseg (int) – Segment length for STFT. Default 256.
noverlap (int, optional) – Overlap between segments. Default nperseg // 2.
mask (ndarray, shape (n_freqs, n_times), optional) – Optional FIXED mask to use instead of adaptive (hybrid mode).
Examples
>>> from mne_denoise.dss.denoisers import SpectrogramDenoiser >>> # Retain only the strongest 10% of TF-bins (aggressive denoising) >>> denoiser = SpectrogramDenoiser(threshold_percentile=90) >>> denoised = denoiser.denoise(source)
See also
SpectrogramBiasFixed linear version.
References
Särelä & Valpola (2005). Section 4.1.3 “SPECTROGRAM DENOISING”
- __init__(threshold_percentile: float = 90.0, nperseg: int = 256, noverlap: int | None = None, mask: ndarray | None = None) None[source]#
Methods
__init__([threshold_percentile, nperseg, ...])denoise(source)Apply adaptive 2D spectrogram masking.