mne.decoding.FilterEstimator¶

class
mne.decoding.
FilterEstimator
(info, l_freq, h_freq, picks=None, filter_length='auto', l_trans_bandwidth='auto', h_trans_bandwidth='auto', n_jobs=1, method='fir', iir_params=None, fir_design='firwin', verbose=None)[source]¶ Estimator to filter RtEpochs.
Applies a zerophase lowpass, highpass, bandpass, or bandstop 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: bandpass filter
l_freq > h_freq: bandstop filter
l_freq is not None, h_freq is None: lowpass filter
l_freq is None, h_freq is not None: highpass 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
 infoinstance of
Info
Measurement info.
 l_freq
float
None
For FIR filters, the lower passband edge; for IIR filters, the upper cutoff frequency. If None the data are only lowpassed.
 h_freq
float
None
For FIR filters, the upper passband edge; for IIR filters, the upper cutoff frequency. If None the data are only highpassed.
 picks
str
list
slice
None
Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g.,
['meg', 'eeg']
) will pick channels of those types, channel name strings (e.g.,['MEG0111', 'MEG2623']
will pick the given channels. Can also be the string values “all” to pick all channels, or “data” to pick data channels. None (default) will pick good data channels. filter_length
str
int
Length of the FIR filter to use (if applicable):
‘auto’ (default): The filter length is chosen based on the size of the transition regions (6.6 times the reciprocal of the shortest transition band for fir_window=’hamming’ and fir_design=”firwin2”, and half that for “firwin”).
str: A humanreadable time in units of “s” or “ms” (e.g., “10s” or “5500ms”) will be converted to that number of samples if
phase="zero"
, or the shortest poweroftwo length at least that duration forphase="zerodouble"
.int: Specified length in samples. For fir_design=”firwin”, this should not be used.
 l_trans_bandwidth
float
str
Width of the transition band at the low cutoff frequency in Hz (high pass or cutoff 1 in bandpass). Can be “auto” (default) to use a multiple of
l_freq
:min(max(l_freq * 0.25, 2), l_freq)
Only used for
method='fir'
. h_trans_bandwidth
float
str
Width of the transition band at the high cutoff frequency in Hz (low pass or cutoff 2 in bandpass). Can be “auto” (default in 0.14) to use a multiple of
h_freq
:min(max(h_freq * 0.25, 2.), info['sfreq'] / 2.  h_freq)
Only used for
method='fir'
. n_jobs
int
str
Number of jobs to run in parallel. Can be ‘cuda’ if
cupy
is installed properly and method=’fir’. method
str
‘fir’ will use overlapadd FIR filtering, ‘iir’ will use IIR forwardbackward 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.
 fir_design
str
Can be “firwin” (default) to use
scipy.signal.firwin()
, or “firwin2” to usescipy.signal.firwin2()
. “firwin” uses a timedomain design technique that generally gives improved attenuation using fewer samples than “firwin2”.New in version 0.15.
 verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more).
 infoinstance of
See also
Notes
This is primarily meant for use in conjunction with
mne_realtime.RtEpochs
. In general it is not recommended in a normal processing pipeline as it may result in edge artifacts. Use with caution.Methods
__hash__
(/)Return hash(self).
fit
(epochs_data, y)Filter data.
fit_transform
(X[, y])Fit to data, then transform it.
transform
(epochs_data)Filter data.

__hash__
(/)¶ Return hash(self).

fit
(epochs_data, y)[source]¶ Filter data.
 Parameters
 Returns
 selfinstance of
FilterEstimator
The modified instance.
 selfinstance of