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]#

Interpolate line-noise amplitudes in a 2-D signal spectrum.

Parameters:
datandarray, shape (n_channels, n_times)

Real-valued channel-first data.

sfreqfloat

Sampling frequency in Hz.

freqsarray-like

Target frequencies in Hz.

bandwidthfloat, default=1.0

Half-width of each replaced target band in Hz.

neighbour_widthfloat, default=2.0

Width of the neighboring reference bands in Hz.

Returns:
ndarray, shape (n_channels, n_times)

Cleaned data with the same shape and units as data.

See also

SpectrumInterpolation

Estimator that resolves target frequencies and preserves MNE containers.

Notes

Amplitudes in target bins are replaced using neighboring amplitudes while the original FFT phase is retained [1].

References

Examples

>>> import numpy as np
>>> from mne_denoise.spectrum_interpolation import interpolate_spectrum
>>> rng = np.random.default_rng(0)
>>> data = rng.standard_normal((8, 2000))
>>> clean = interpolate_spectrum(data, sfreq=250.0, freqs=np.array([60.0, 120.0]))