mne_denoise.dss.LineNoiseBias#

class mne_denoise.dss.LineNoiseBias(freq: float, sfreq: float, *, method: str = 'fft', n_harmonics: int | None = None, bandwidth: float = 1.0, order: int = 4, nfft: int = 1024, overlap: float = 0.5)[source]#

Line-frequency bias using IIR or FFT selection.

Parameters:
freqfloat

Fundamental line frequency in Hz.

sfreqfloat

Sampling frequency in Hz.

method{“fft”, “iir”}, default=”fft”

Use exact FFT-bin selection or a narrow IIR bandpass.

n_harmonicsint or None, default=None

Number of harmonics in FFT mode; None includes valid harmonics below Nyquist.

bandwidthfloat, default=1.0

IIR bandpass width in Hz.

orderint, default=4

IIR bandpass order.

nfftint, default=1024

FFT block length.

overlapfloat, default=0.5

Accepted for API compatibility; the current FFT implementation does not use this value.

Notes

FFT mode retains one rounded positive-frequency bin per harmonic and its conjugate bin. It processes rectangular, non-overlapping blocks of length nfft; a trailing short block is zero-padded and truncated on output. Three-dimensional channel-first input is processed epoch by epoch. IIR mode uses BandpassBias around the fundamental frequency.

apply(data: ndarray) ndarray[source]#

Apply the configured line-frequency bias.

Parameters:
datandarray, shape (n_channels, n_times) or (n_channels, n_times, n_epochs)

Channel-first data.

Returns:
ndarray

Selected line-frequency content with the input shape.