mne.filter.band_pass_filter

mne.filter.band_pass_filter(x, Fs, Fp1, Fp2, filter_length='10s', l_trans_bandwidth=0.5, h_trans_bandwidth=0.5, method='fft', iir_params=None, picks=None, n_jobs=1, copy=True, verbose=None)

Bandpass filter for the signal x.

Applies a zero-phase bandpass filter to the signal x, operating on the last dimension.

Parameters:

x : array

Signal to filter.

Fs : float

Sampling rate in Hz.

Fp1 : float

Low cut-off frequency in Hz.

Fp2 : float

High cut-off frequency in Hz.

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. Not used for ‘iir’ filters.

l_trans_bandwidth : float

Width of the transition band at the low cut-off frequency in Hz. Not used if ‘order’ is specified in iir_params.

h_trans_bandwidth : float

Width of the transition band at the high cut-off frequency in Hz. Not used if ‘order’ is specified in iir_params.

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.

picks : array-like of int | None

Indices to filter. If None all indices will be filtered.

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’.

copy : bool

If True, a copy of x, filtered, is returned. Otherwise, it operates on x in place.

verbose : bool, str, int, or None

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

Returns:

xf : array

x filtered.

Notes

The frequency response is (approximately) given by:

       ----------
     /|         |                   / |         |                   /  |         |                   /   |         |          ----------    |         |     -----------------
      |         |
Fs1  Fp1       Fp2   Fs2

Where:

Fs1 = Fp1 - l_trans_bandwidth in Hz Fs2 = Fp2 + h_trans_bandwidth in Hz