gastropy.design_fir_bandpass

gastropy.design_fir_bandpass#

gastropy.design_fir_bandpass(low_hz, high_hz, sfreq, f_order=5, transition_width=0.2, window='hann')[source]#

Design a FIR bandpass filter with adaptive tap count.

Tap count is scaled based on the lower cutoff frequency and transition width, matching the behavior of MATLAB-based EGG analysis pipelines.

Parameters:
  • low_hz (float) – Lower passband edge in Hz.

  • high_hz (float) – Upper passband edge in Hz.

  • sfreq (float) – Sampling frequency in Hz.

  • f_order (int, optional) – Filter order scaling factor. Default is 5.

  • transition_width (float, optional) – Normalized transition width (0 to 1). Default is 0.20.

  • window (str, optional) – Window function for FIR design. Default is "hann".

Returns:

  • b (np.ndarray) – FIR filter coefficients (numerator).

  • a (np.ndarray) – Denominator coefficients (always [1.0] for FIR).

Examples

>>> b, a = design_fir_bandpass(0.03, 0.07, sfreq=10.0)
>>> len(b)  # number of taps (odd)
51