mne_filter#

class filter.mne_filter.MNEFilter(f_ranges: Sequence[tuple[float | None, float | None]], sfreq: float, filter_length: str | float = '999ms', l_trans_bandwidth: float | str = 4, h_trans_bandwidth: float | str = 4, verbose: bool | int | str | None = None)[source]#

mne.filter wrapper

This class stores for given frequency band ranges the filter coefficients with length “filter_len”. The filters can then be used sequentially for band power estimation with apply_filter(). Note that this filter can be a bandpass, bandstop, lowpass, or highpass filter depending on the frequency ranges given (see further details in mne.filter.create_filter).

Parameters:
  • f_ranges (list[tuple[float | None, float | None]])

  • sfreq (float) – Sampling frequency.

  • filter_length (str, optional) – Filter length. Human readable (e.g. “1000ms”, “1s”), by default “999ms”

  • l_trans_bandwidth (float | str, optional) – Length of the lower transition band or “auto”, by default 4

  • h_trans_bandwidth (float | str, optional) – Length of the higher transition band or “auto”, by default 4

  • verbose (bool | None, optional) – Verbosity level, by default None

filter_bank#

Factor to upsample by.

Type:

np.ndarray shape (n,)

filter_data(data: ndarray) ndarray[source]#

Apply previously calculated (bandpass) filters to data.

Parameters:
  • data (np.ndarray (n_samples, ) or (n_channels, n_samples)) – Data to be filtered

  • filter_bank (np.ndarray, shape (n_fbands, filter_len)) – Output of calc_bandpass_filters.

Returns:

Filtered data.

Return type:

np.ndarray, shape (n_channels, n_fbands, n_samples)