copapy.filters.firwin#

copapy.filters.firwin(numtaps, cutoff, pass_zero='lowpass', window='hamming', fs=2.0)#

Coefficients of a linear phase FIR filter designed by the window method (like scipy.signal.firwin). The filter is applied with convolve:

>>> taps = filters.firwin(31, 50.0, fs=1000.0)
>>> filtered = filters.convolve(samples, taps, 'same')
Parameters:
  • numtaps (int) – Number of coefficients, the delay of the filter is (numtaps - 1) / 2 samples. It must be odd for a high-pass.

  • cutoff (float | Sequence[float]) – Cutoff frequency (half amplitude) in the unit of fs, two frequencies (lower, upper) for a band-pass.

  • pass_zero (str) – ‘lowpass’, ‘highpass’ or ‘bandpass’

  • window (str) – ‘hamming’, ‘hann’, ‘blackman’ or ‘rectangular’

  • fs (float) – Sampling frequency, cutoff is relative to the Nyquist frequency for the default of 2.

Return type:

list[float]

Returns:

Coefficients scaled to a gain of 1 at frequency 0 (low-pass), at the Nyquist frequency (high-pass) or at the center of the band (band-pass).