mne.filter.band_pass_filter(x, Fs, Fp1, Fp2, filter_length='', l_trans_bandwidth=None, h_trans_bandwidth=None, method='fir', iir_params=None, picks=None, n_jobs=1, copy=True, phase='', fir_window='', verbose=None)

Bandpass filter for the signal x.

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


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 | int

Length of the FIR filter to use (if applicable):

  • int: specified length in samples.
  • ‘auto’ (default in 0.14): 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’).
  • str: (default in 0.13 is “10s”) a human-readable 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 power-of-two length at least that duration for phase="zero-double".

l_trans_bandwidth : float | str

Width of the transition band at the low cut-off frequency in Hz Can be “auto” (default in 0.14) 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 cut-off frequency in Hz 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'.

method : str

‘fir’ 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 of channels to filter. If None all channels will be filtered. Only supported for 2D (n_channels, n_times) and 3D (n_epochs, n_channels, n_times) data.

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

copy : bool

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

phase : str

Phase of the filter, only used if method='fir'. By default, a symmetric linear-phase FIR filter is constructed. If phase='zero' (default in 0.14), the delay of this filter is compensated for. If phase=='zero-double' (default in 0.13 and before), then this filter is applied twice, once forward, and once backward.

New in version 0.13.

fir_window : str

The window to use in FIR design, can be “hamming” (default in 0.14), “hann” (default in 0.13), or “blackman”.

New in version 0.13.

verbose : bool, str, int, or None

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


xf : array

x filtered.

See also

filter_data, band_stop_filter, high_pass_filter, low_pass_filter, notch_filter, resample


The frequency response is (approximately) given by:

1-|               ----------
  |             /|         |      |H| |            / |         |           |           /  |         |            |          /   |         |           0-|----------    |         |     --------------
  |         |    |         |     |            |
  0        Fs1  Fp1       Fp2   Fs2          Nyq


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