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, verbose: bool | str | int | None = None)[source]#
Line-noise remover based on amplitude spectrum interpolation.
- Parameters:
- sfreqfloat or None, default=None
Sampling frequency in Hz; inferred from MNE metadata when available.
- line_freqfloat or array-like, default=50.0
Fundamental frequency or explicit target frequencies in Hz.
- n_harmonicsint or None, default=None
Number of harmonics when line_freq is scalar; None uses all harmonics below Nyquist.
- bandwidthfloat, default=1.0
Half-width of each replaced band in Hz.
- neighbour_widthfloat, default=2.0
Width of each neighboring reference band in Hz.
- verbosebool, str, int, or None, default=None
Logging level.
- Attributes:
- sfreq_float
Sampling frequency used during fit.
- freqs_ndarray
Resolved target frequencies.
See also
interpolate_spectrumOne-shot array interface.
mne_denoise.zapline.ZapLineDSS-based spatial line-noise removal.
Notes
NumPy input uses 2-D or 3-D channel-first layouts; 3-D records are processed independently. MNE data channels are processed while non-data channels and container metadata are preserved. Short segments may have limited spectral resolution [1].
References
Examples
>>> import numpy as np >>> from mne_denoise.spectrum_interpolation import SpectrumInterpolation >>> rng = np.random.default_rng(0) >>> data = rng.standard_normal((8, 2000)) >>> model = SpectrumInterpolation(sfreq=250.0, line_freq=60.0, n_harmonics=2) >>> clean = model.fit_transform(data)
- fit(X: Any, y: Any = None, *, verbose: bool | str | int | None = None) SpectrumInterpolation[source]#
Resolve the sampling frequency and target frequencies.
- Parameters:
- XRaw, Epochs, Evoked, or ndarray
Input whose metadata or shape is inspected.
- yNone, default=None
Ignored for scikit-learn compatibility.
- verbosebool, str, int, or None, default=None
Logging level.
- Returns:
- SpectrumInterpolation
The fitted estimator.
- fit_transform(X: Any, y: Any = None, *, verbose: bool | str | int | None = None, **fit_params: Any) Any[source]#
Fit spectrum interpolation and transform X.
- Parameters:
- XRaw, Epochs, Evoked, or ndarray
Data to clean.
- yNone, default=None
Ignored for scikit-learn compatibility.
- verbosebool, str, int, or None, default=None
Logging level.
- **fit_paramsdict
Ignored for scikit-learn compatibility.
- Returns:
- same type as X
Cleaned data.