ezmsg.sigproc.fir_pmc#
Functions
- parks_mcclellan_design_fun(fs, order=0, cuton=None, cutoff=None, transition=10.0, weight_pass=1.0, weight_stop_lo=1.0, weight_stop_hi=1.0)[source]#
See
ParksMcClellanFIRSettings.filter_specsfor an explanation of specifying different filter types (lowpass, highpass, bandpass, bandstop) from the parameters.Designs a Parks-McClellan FIR filter via the Remez exchange algorithm using the given specifications. PMC filters are equiripple and linear phase.
You are likely to want to use this function with
filter_by_design, which only passes fs to the design function (this), meaning that you should wrap this function with a lambda or prepare with functools.partial.- Parameters:
fs (float) – The sampling frequency of the data in Hz.
order (int) – Filter order.
cuton (float | None) – Corner frequency of the filter in Hz.
cutoff (float | None) – Corner frequency of the filter in Hz.
transition (float) – Transition bandwidth (Hz) applied to each passband edge.
weight_pass (float) – Weight for the passband.
weight_stop_lo (float) – Weight for the lower stopband.
weight_stop_hi (float) – Weight for the upper stopband.
- Returns:
The filter coefficients as a tuple of (b, a).
- Return type:
tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | None
Classes
- class ParksMcClellanFIR(*args, settings=None, **kwargs)[source]#
Bases:
BaseFilterByDesignTransformerUnit[ParksMcClellanFIRSettings,ParksMcClellanFIRTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
ParksMcClellanFIRSettings
- class ParksMcClellanFIRSettings(axis=None, coef_type='ba', order=0, cuton=None, cutoff=None, transition=10.0, weight_pass=1.0, weight_stop_lo=1.0, weight_stop_hi=1.0)[source]#
Bases:
FilterBaseSettingsSettings for
ParksMcClellanFIR.- Parameters:
- order: int = 0#
Filter order (taps = order + 1). PMC FIR filters require even order (odd taps). If odd order (even taps), order will be incremented by 1.
- cuton: float | None = None#
Cuton frequency (Hz). If cutoff is not specified then this is the highpass corner. Otherwise, if this is lower than cutoff then this is the beginning of the bandpass or if this is greater than cutoff then this is the end of the bandstop.
- cutoff: float | None = None#
Cutoff frequency (Hz). If cuton is not specified then this is the lowpass corner. Otherwise, if this is greater than cuton then this is the end of the bandpass, or if this is less than cuton then this is the beginning of the bandstop.
- transition: float = 10.0#
Transition bandwidth (Hz) applied to each passband edge. For low/high: single transition. For bands: both edges.
- weight_pass: float = 1.0#
Weight for the passband. Used for both high and low passbands in bandstop filters.
- __init__(axis=None, coef_type='ba', order=0, cuton=None, cutoff=None, transition=10.0, weight_pass=1.0, weight_stop_lo=1.0, weight_stop_hi=1.0)#
- weight_stop_hi: float = 1.0#
Weight for the upper stopband. Used as the central-stop weight for bandstop filters.
- class ParksMcClellanFIRTransformer(*args, **kwargs)[source]#
Bases:
FilterByDesignTransformer[ParksMcClellanFIRSettings,tuple[ndarray[tuple[Any, …],dtype[_ScalarT]],ndarray[tuple[Any, …],dtype[_ScalarT]]]]
- class ParksMcClellanFIRSettings(axis=None, coef_type='ba', order=0, cuton=None, cutoff=None, transition=10.0, weight_pass=1.0, weight_stop_lo=1.0, weight_stop_hi=1.0)[source]#
Bases:
FilterBaseSettingsSettings for
ParksMcClellanFIR.- Parameters:
- order: int = 0#
Filter order (taps = order + 1). PMC FIR filters require even order (odd taps). If odd order (even taps), order will be incremented by 1.
- cuton: float | None = None#
Cuton frequency (Hz). If cutoff is not specified then this is the highpass corner. Otherwise, if this is lower than cutoff then this is the beginning of the bandpass or if this is greater than cutoff then this is the end of the bandstop.
- cutoff: float | None = None#
Cutoff frequency (Hz). If cuton is not specified then this is the lowpass corner. Otherwise, if this is greater than cuton then this is the end of the bandpass, or if this is less than cuton then this is the beginning of the bandstop.
- transition: float = 10.0#
Transition bandwidth (Hz) applied to each passband edge. For low/high: single transition. For bands: both edges.
- weight_pass: float = 1.0#
Weight for the passband. Used for both high and low passbands in bandstop filters.
- __init__(axis=None, coef_type='ba', order=0, cuton=None, cutoff=None, transition=10.0, weight_pass=1.0, weight_stop_lo=1.0, weight_stop_hi=1.0)#
- weight_stop_hi: float = 1.0#
Weight for the upper stopband. Used as the central-stop weight for bandstop filters.
- parks_mcclellan_design_fun(fs, order=0, cuton=None, cutoff=None, transition=10.0, weight_pass=1.0, weight_stop_lo=1.0, weight_stop_hi=1.0)[source]#
See
ParksMcClellanFIRSettings.filter_specsfor an explanation of specifying different filter types (lowpass, highpass, bandpass, bandstop) from the parameters.Designs a Parks-McClellan FIR filter via the Remez exchange algorithm using the given specifications. PMC filters are equiripple and linear phase.
You are likely to want to use this function with
filter_by_design, which only passes fs to the design function (this), meaning that you should wrap this function with a lambda or prepare with functools.partial.- Parameters:
fs (float) – The sampling frequency of the data in Hz.
order (int) – Filter order.
cuton (float | None) – Corner frequency of the filter in Hz.
cutoff (float | None) – Corner frequency of the filter in Hz.
transition (float) – Transition bandwidth (Hz) applied to each passband edge.
weight_pass (float) – Weight for the passband.
weight_stop_lo (float) – Weight for the lower stopband.
weight_stop_hi (float) – Weight for the upper stopband.
- Returns:
The filter coefficients as a tuple of (b, a).
- Return type:
tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | None
- class ParksMcClellanFIRTransformer(*args, **kwargs)[source]#
Bases:
FilterByDesignTransformer[ParksMcClellanFIRSettings,tuple[ndarray[tuple[Any, …],dtype[_ScalarT]],ndarray[tuple[Any, …],dtype[_ScalarT]]]]
- class ParksMcClellanFIR(*args, settings=None, **kwargs)[source]#
Bases:
BaseFilterByDesignTransformerUnit[ParksMcClellanFIRSettings,ParksMcClellanFIRTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
ParksMcClellanFIRSettings