mne_denoise.qa.spectral_distortion#

mne_denoise.qa.spectral_distortion(freqs: ndarray, psd_before: ndarray, psd_after: ndarray, line_freq: float = 50.0, n_harmonics: int = 3, bandwidth: float = 2.0) float[source]#

Compute RMS log-power distortion away from line-noise harmonics.

Parameters:
freqsndarray, shape (n_freqs,)

Frequency vector in Hz.

psd_before, psd_afterndarray, shape (n_freqs,) or (n_channels, n_freqs)

PSDs before and after cleaning; channels are averaged for 2-D input.

line_freqfloat, default=50.0

Fundamental line frequency in Hz.

n_harmonicsint, default=3

Number of harmonics to exclude.

bandwidthfloat, default=2.0

Base half-width; the implementation excludes line_freq * k +/- 2 * bandwidth.

Returns:
float

RMS distortion in dB over 2–160 Hz. An empty mask returns 0.0.