Skip to content

Introduction

openseize.filtering.iir

A collection of callable Infinite Impulse Response filters.

IIR filters typically have far fewer coeffecients than similarly designed FIR filters. However, IIRs are not linear phase and not guaranteed to be stable. For these reasons FIR filters are the recommended design in Openseize. Nevertheless if you require a fast filter and are unconcerned with correcting the filter's delay, IIRs may be the right choice. This

module provides the following IIRs
  • Butterworth (Butter): IIR that is maximally flat in the pass band but has slow roll-off.
  • Chebyshev I (Cheby1): IIR that allows for ripple in the pass band and faster roll-off.
  • Chebyshev II (Cheby2): IIR that allows for ripple in the stop band and has fast roll-off.
  • Elliptical (Ellip): IIR that allows for ripple in the pass and stop band and has fast roll-off
  • Notch: A specialized IIR for rejecting a single frequency.

Examples:

>>> # Design a lowpass Butterworth with a passband edge at 500 Hz and
... # transition width of 100 Hz. It should have no more than 0.5 dB
... # ripple in the pass band and reach 40 dB attenuation in the stop
... # band
>>> butter = Butter(fpass=500, fstop=600, fs=5000, gpass=0.5, gstop=40)
>>> # print the filter to see its attributes
>>> print(butter)
>>> # plot the filter to see its design
>>> butter.plot()
>>> # apply the filter to a producer of ndarrays without correcting the
... # phase delay (dephase=False)
>>> result = butter(pro, chunksize=10000, axis=-1, dephase=False)