mne_denoise.spectrum_interpolation.SpectrumInterpolation#

class mne_denoise.spectrum_interpolation.SpectrumInterpolation(sfreq: float | None = None, line_freq: float | ArrayLike = 50.0, n_harmonics: int | None = None, bandwidth: float = 1.0, neighbour_width: float = 2.0)[source]#

Remove power-line noise by amplitude spectrum interpolation.

Frequency-domain line-noise remover following Leske & Dalal (2019) [1]. The amplitude of a thin band around the line frequency (and its harmonics) is replaced by the mean amplitude of neighbouring bins, while the phase is preserved.

Parameters:
  • sfreq (float, optional) – Sampling frequency in Hz. Required for NumPy-array inputs; for MNE objects it is read from info['sfreq'] and overrides this value.

  • line_freq (float | array-like of float) – Power-line frequency in Hz (e.g. 50 or 60). A sequence of explicit frequencies may be given instead, in which case they are used directly. Default 50.0.

  • n_harmonics (int, optional) – Number of harmonics of line_freq to remove (including the fundamental). If None, all harmonics below the Nyquist frequency are removed. Ignored when line_freq is a sequence.

  • bandwidth (float) – Half-width in Hz of the interpolated band around each frequency. For example, bandwidth=1 replaces 49–51 Hz around a 50 Hz target. Default 1.0.

  • neighbour_width (float) – Width in Hz of the reference band on each side used to estimate the replacement amplitude. Default 2.0.

sfreq_#

Sampling frequency used during the fit.

Type:

float

freqs_#

Resolved target frequencies (line frequency and harmonics).

Type:

ndarray

Examples

>>> from mne_denoise.spectrum_interpolation import SpectrumInterpolation
>>> si = SpectrumInterpolation(sfreq=1000.0, line_freq=60.0)
>>> clean = si.fit_transform(data)

Notes

This FFT-based method is best suited to continuous recordings or long data segments with stationary line noise. Short epochs can exhibit edge effects, especially when their duration does not contain complete cycles of the targeted frequencies. Inspect the result when processing short epochs.

References

[1]

Leske, S., & Dalal, S. S. (2019). Reducing power line noise in EEG and MEG data via spectrum interpolation. NeuroImage, 189, 763-776.

__init__(sfreq: float | None = None, line_freq: float | ArrayLike = 50.0, n_harmonics: int | None = None, bandwidth: float = 1.0, neighbour_width: float = 2.0) None[source]#

Methods

__init__([sfreq, line_freq, n_harmonics, ...])

fit(X[, y])

Resolve the sampling rate and target frequencies.

fit_transform(X[, y])

Fit then transform X in one step.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Apply spectrum interpolation to X.