mne.decoding.FilterEstimator

class mne.decoding.FilterEstimator(info, l_freq, h_freq, picks=None, filter_length='', l_trans_bandwidth=None, h_trans_bandwidth=None, n_jobs=1, method='fft', iir_params=None, verbose=None)

Estimator to filter RtEpochs

Applies a zero-phase low-pass, high-pass, band-pass, or band-stop filter to the channels selected by “picks”.

l_freq and h_freq are the frequencies below which and above which, respectively, to filter out of the data. Thus the uses are:

  • l_freq < h_freq: band-pass filter
  • l_freq > h_freq: band-stop filter
  • l_freq is not None, h_freq is None: low-pass filter
  • l_freq is None, h_freq is not None: high-pass filter

If n_jobs > 1, more memory is required as “len(picks) * n_times” additional time points need to be temporarily stored in memory.

Parameters:

info : instance of Info

Measurement info.

l_freq : float | None

Low cut-off frequency in Hz. If None the data are only low-passed.

h_freq : float | None

High cut-off frequency in Hz. If None the data are only high-passed.

picks : array-like of int | None

Indices of channels to filter. If None only the data (MEG/EEG) channels will be filtered.

filter_length : str (Default: ‘10s’) | int | None

Length of the filter to use. If None or “len(x) < filter_length”, the filter length used is len(x). Otherwise, if int, overlap-add filtering with a filter of the specified length in samples) is used (faster for long signals). If str, a human-readable time in units of “s” or “ms” (e.g., “10s” or “5500ms”) will be converted to the shortest power-of-two length at least that duration.

l_trans_bandwidth : float

Width of the transition band at the low cut-off frequency in Hz.

h_trans_bandwidth : float

Width of the transition band at the high cut-off frequency in Hz.

n_jobs : int | str

Number of jobs to run in parallel. Can be ‘cuda’ if scikits.cuda is installed properly, CUDA is initialized, and method=’fft’.

method : str

‘fft’ will use overlap-add FIR filtering, ‘iir’ will use IIR forward-backward filtering (via filtfilt).

iir_params : dict | None

Dictionary of parameters to use for IIR filtering. See mne.filter.construct_iir_filter for details. If iir_params is None and method=”iir”, 4th order Butterworth will be used.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose). Defaults to self.verbose.

See also

TemporalFilter

Methods

__hash__() <==> hash(x)
fit(epochs_data, y) Filters data
fit_transform(X[, y]) Fit to data, then transform it
transform(epochs_data[, y]) Filters data
__hash__() <==> hash(x)
fit(epochs_data, y)

Filters data

Parameters:

epochs_data : array, shape (n_epochs, n_channels, n_times)

The data.

y : array, shape (n_epochs,)

The label for each epoch.

Returns:

self : instance of FilterEstimator

Returns the modified instance

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters:

X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.

Returns:

X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.

transform(epochs_data, y=None)

Filters data

Parameters:

epochs_data : array, shape (n_epochs, n_channels, n_times)

The data.

y : None | array, shape (n_epochs,)

The label for each epoch. If None not used. Defaults to None.

Returns:

X : array, shape (n_epochs, n_channels, n_times)

The data after filtering