ezmsg.sigproc.butterworthfilter#
Functions
- butter(axis, order=0, cuton=None, cutoff=None, coef_type='ba', wn_hz=True)[source]#
Convenience generator wrapping filter_gen_by_design for Butterworth filters. Apply Butterworth filter to streaming data. Uses
scipy.signal.butterto design the filter. SeeButterworthFilterSettings.filter_specsfor an explanation of specifying different filter types (lowpass, highpass, bandpass, bandstop) from the parameters.- Returns:
- Parameters:
- Return type:
- butter_design_fun(fs, order=0, cuton=None, cutoff=None, coef_type='ba', wn_hz=True)[source]#
See
ButterworthFilterSettings.filter_specsfor an explanation of specifying different filter types (lowpass, highpass, bandpass, bandstop) from the parameters. You are likely to want to use this function withfilter_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.
coef_type (str) – “ba”, “sos”, or “zpk”
wn_hz (bool) – Set False if provided Wn are normalized from 0 to 1, where 1 is the Nyquist frequency
- Returns:
The filter coefficients as a tuple of (b, a) for coef_type “ba”, or as a single ndarray for “sos”, or (z, p, k) for “zpk”.
- Return type:
tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | ndarray[tuple[Any, …], dtype[_ScalarT]] | None
Classes
- class ButterworthFilter(*args, settings=None, **kwargs)[source]#
Bases:
BaseFilterByDesignTransformerUnit[ButterworthFilterSettings,ButterworthFilterTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
ButterworthFilterSettings
- class ButterworthFilterSettings(axis=None, coef_type='ba', order=0, cuton=None, cutoff=None, wn_hz=True)[source]#
Bases:
FilterBaseSettingsSettings for
ButterworthFilter.- Parameters:
- 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.
- wn_hz: bool = True#
Set False if provided Wn are normalized from 0 to 1, where 1 is the Nyquist frequency
- class ButterworthFilterTransformer(*args, **kwargs)[source]#
Bases:
FilterByDesignTransformer[ButterworthFilterSettings,tuple[ndarray[tuple[Any, …],dtype[_ScalarT]],ndarray[tuple[Any, …],dtype[_ScalarT]]] |ndarray[tuple[Any, …],dtype[_ScalarT]]]
- class ButterworthFilterSettings(axis=None, coef_type='ba', order=0, cuton=None, cutoff=None, wn_hz=True)[source]#
Bases:
FilterBaseSettingsSettings for
ButterworthFilter.- Parameters:
- 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.
- wn_hz: bool = True#
Set False if provided Wn are normalized from 0 to 1, where 1 is the Nyquist frequency
- butter_design_fun(fs, order=0, cuton=None, cutoff=None, coef_type='ba', wn_hz=True)[source]#
See
ButterworthFilterSettings.filter_specsfor an explanation of specifying different filter types (lowpass, highpass, bandpass, bandstop) from the parameters. You are likely to want to use this function withfilter_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.
coef_type (str) – “ba”, “sos”, or “zpk”
wn_hz (bool) – Set False if provided Wn are normalized from 0 to 1, where 1 is the Nyquist frequency
- Returns:
The filter coefficients as a tuple of (b, a) for coef_type “ba”, or as a single ndarray for “sos”, or (z, p, k) for “zpk”.
- Return type:
tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | ndarray[tuple[Any, …], dtype[_ScalarT]] | None
- class ButterworthFilterTransformer(*args, **kwargs)[source]#
Bases:
FilterByDesignTransformer[ButterworthFilterSettings,tuple[ndarray[tuple[Any, …],dtype[_ScalarT]],ndarray[tuple[Any, …],dtype[_ScalarT]]] |ndarray[tuple[Any, …],dtype[_ScalarT]]]
- class ButterworthFilter(*args, settings=None, **kwargs)[source]#
Bases:
BaseFilterByDesignTransformerUnit[ButterworthFilterSettings,ButterworthFilterTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
ButterworthFilterSettings
- butter(axis, order=0, cuton=None, cutoff=None, coef_type='ba', wn_hz=True)[source]#
Convenience generator wrapping filter_gen_by_design for Butterworth filters. Apply Butterworth filter to streaming data. Uses
scipy.signal.butterto design the filter. SeeButterworthFilterSettings.filter_specsfor an explanation of specifying different filter types (lowpass, highpass, bandpass, bandstop) from the parameters.- Returns:
- Parameters:
- Return type: