cupyx.scipy.signal.iirfilter#

cupyx.scipy.signal.iirfilter(N, Wn, rp=None, rs=None, btype='band', analog=False, ftype='butter', output='ba', fs=None)[source]#

IIR digital and analog filter design given order and critical points.

Design an Nth-order digital or analog filter and return the filter coefficients.

Parameters:
  • N (int) – The order of the filter.

  • Wn (array_like) –

    A scalar or length-2 sequence giving the critical frequencies.

    For digital filters, Wn are in the same units as fs. By default, fs is 2 half-cycles/sample, so these are normalized from 0 to 1, where 1 is the Nyquist frequency. (Wn is thus in half-cycles / sample.)

    For analog filters, Wn is an angular frequency (e.g., rad/s).

    When Wn is a length-2 sequence, Wn[0] must be less than Wn[1].

  • rp (float, optional) – For Chebyshev and elliptic filters, provides the maximum ripple in the passband. (dB)

  • rs (float, optional) – For Chebyshev and elliptic filters, provides the minimum attenuation in the stop band. (dB)

  • btype ({'bandpass', 'lowpass', 'highpass', 'bandstop'}, optional) – The type of filter. Default is ‘bandpass’.

  • analog (bool, optional) – When True, return an analog filter, otherwise a digital filter is returned.

  • ftype (str, optional) –

    The type of IIR filter to design:

    • Butterworth : ‘butter’

    • Chebyshev I : ‘cheby1’

    • Chebyshev II : ‘cheby2’

    • Cauer/elliptic: ‘ellip’

    • Bessel/Thomson: ‘bessel’

  • output ({'ba', 'zpk', 'sos'}, optional) –

    Filter form of the output:

    • second-order sections (recommended): ‘sos’

    • numerator/denominator (default) : ‘ba’

    • pole-zero : ‘zpk’

    In general the second-order sections (‘sos’) form is recommended because inferring the coefficients for the numerator/denominator form (‘ba’) suffers from numerical instabilities. For reasons of backward compatibility the default form is the numerator/denominator form (‘ba’), where the ‘b’ and the ‘a’ in ‘ba’ refer to the commonly used names of the coefficients used.

    Note: Using the second-order sections form (‘sos’) is sometimes associated with additional computational costs: for data-intense use cases it is therefore recommended to also investigate the numerator/denominator form (‘ba’).

  • fs (float, optional) – The sampling frequency of the digital system.

Returns:

  • b, a (ndarray, ndarray) – Numerator (b) and denominator (a) polynomials of the IIR filter. Only returned if output='ba'.

  • z, p, k (ndarray, ndarray, float) – Zeros, poles, and system gain of the IIR filter transfer function. Only returned if output='zpk'.

  • sos (ndarray) – Second-order sections representation of the IIR filter. Only returned if output='sos'.

See also

butter

Filter design using order and critical points

cheby1, cheby2, ellip, bessel

buttord

Find order and critical points from passband and stopband spec

cheb1ord, cheb2ord, ellipord

iirdesign

General filter design using passband and stopband spec

scipy.signal.iirfilter