mne_denoise.spectrum_interpolation.interpolate_spectrum#

mne_denoise.spectrum_interpolation.interpolate_spectrum(data: ndarray, sfreq: float, freqs: ndarray, *, bandwidth: float = 1.0, neighbour_width: float = 2.0) ndarray[source]#

Remove line noise from 2D data by amplitude spectrum interpolation.

For each target frequency, the amplitude of the FFT bins inside a band of half-width bandwidth is replaced by the mean amplitude of the neighbouring reference bands. The original phase is kept, following Leske & Dalal (2019) [1].

Parameters:
  • data (ndarray, shape (n_channels, n_times)) – Input time series. Each channel is processed independently.

  • sfreq (float) – Sampling frequency in Hz.

  • freqs (array-like of float) – Target frequencies (e.g. the line frequency and its harmonics) in Hz.

  • bandwidth (float) – Half-width in Hz of the band that is interpolated around each target 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 used on each side of the interpolated band to estimate the replacement amplitude. Default 2.0.

Returns:

cleaned – Line-noise-reduced time series, in the same units as data.

Return type:

ndarray, shape (n_channels, n_times)

References

[1]

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