iirfilter
: IIR filter init#
Tools for initialising parameters for an IIR filter layer.
IIRFilterSpec
#
- class hypercoil.init.iirfilter.IIRFilterSpec(Wn: float | Tuple[float, float], N: int, ftype: Literal['butter', 'cheby1', 'cheby2', 'ellip', 'bessel'] = 'butter', btype: Literal['bandpass', 'bandstop', 'lowpass', 'highpass'] = 'bandpass', fs: float | None = None, rp: float = 0.1, rs: float = 20, norm: Literal['phase', 'mag', 'delay'] = 'phase')[source]#
Specification for filter coefficients for recursive IIR filter classes.
- Parameters:
- Wnfloat or tuple(float, float)
Critical or cutoff frequency. If this is a band-pass filter, then this should be a tuple, with the first entry specifying the high-pass cutoff and the second entry specifying the low-pass frequency. This should be specified relative to the Nyquist frequency if
fs
is not provided, and should be in the same units asfs
if it is provided.- Nint or Tensor (default 1)
Filter order.
- ftypeone of (
'butter'
,'cheby1'
,'cheby2'
,'ellip'
,'bessel'
,'kuznetsov'
) Filter class to initialise: Butterworth, Chebyshev I, Chebyshev II, elliptic, or Bessel-Thompson.
Note
To initialise an ideal filter, use a frequency product filter instead.
- btype
'bandpass'
(default) or'bandstop'
or'lowpass'
or'highpass'
Filter pass-band to emulate: low-pass, high-pass, or band-pass. The interpretation of the critical frequency changes depending on the filter type.
- fsfloat or None (default None)
Sampling frequency.
- rpfloat (default 0.1)
Pass-band ripple. Used only for Chebyshev I and elliptic filters.
- rsfloat (default 20)
Stop-band ripple. Used only for Chebyshev II and elliptic filters.
- norm
'phase'
or'mag'
or'delay'
(default'phase'
) Critical frequency normalisation. Consult the
scipy.signal.bessel
documentation for details.
- Attributes:
- fs
Methods
initialise_coefs