ezmsg.sigproc.kaiser#

Functions

kaiser_design_fun(fs, cutoff=None, ripple=None, width=None, pass_zero=True, wn_hz=True)[source]#

Design an order`th-order FIR Kaiser filter and return the filter coefficients. See :obj:`FIRFilterSettings for argument description.

Returns:

The filter taps as designed by firwin

Parameters:
Return type:

tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | None

Classes

class KaiserFilter(*args, settings=None, **kwargs)[source]#

Bases: BaseFilterByDesignTransformerUnit[KaiserFilterSettings, KaiserFilterTransformer]

Parameters:

settings (Settings | None)

SETTINGS#

alias of KaiserFilterSettings

class KaiserFilterSettings(axis=None, coef_type='ba', cutoff=None, ripple=None, width=None, pass_zero=True, wn_hz=True)[source]#

Bases: FilterBaseSettings

Settings for KaiserFilter

Parameters:
cutoff: float | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None#

Cutoff frequency of filter (expressed in the same units as fs) OR an array of cutoff frequencies (that is, band edges). In the former case, as a float, the cutoff frequency should correspond with the half-amplitude point, where the attenuation will be -6dB. In the latter case, the frequencies in cutoff should be positive and monotonically increasing between 0 and fs/2. The values 0 and fs/2 must not be included in cutoff.

ripple: float | None = None#

Upper bound for the deviation (in dB) of the magnitude of the filter’s frequency response from that of the desired filter (not including frequencies in any transition intervals). See scipy.signal.kaiserord for more information.

width: float | None = None#

If width is not None, then assume it is the approximate width of the transition region (expressed in the same units as fs) for use in Kaiser FIR filter design. See scipy.signal.kaiserord for more information.

pass_zero: bool | str = True#

If True, the gain at the frequency 0 (i.e., the “DC gain”) is 1. If False, the DC gain is 0. Can also be a string argument for the desired filter type (equivalent to btype in IIR design functions). {‘lowpass’, ‘highpass’, ‘bandpass’, ‘bandstop’}

wn_hz: bool = True#

Set False if cutoff and width are normalized from 0 to 1, where 1 is the Nyquist frequency

__init__(axis=None, coef_type='ba', cutoff=None, ripple=None, width=None, pass_zero=True, wn_hz=True)#
Parameters:
Return type:

None

class KaiserFilterTransformer(*args, **kwargs)[source]#

Bases: FilterByDesignTransformer[KaiserFilterSettings, tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]]]

get_design_function()[source]#

Return a function that takes sampling frequency and returns filter coefficients.

Return type:

Callable[[float], tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | None]

class KaiserFilterSettings(axis=None, coef_type='ba', cutoff=None, ripple=None, width=None, pass_zero=True, wn_hz=True)[source]#

Bases: FilterBaseSettings

Settings for KaiserFilter

Parameters:
cutoff: float | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None#

Cutoff frequency of filter (expressed in the same units as fs) OR an array of cutoff frequencies (that is, band edges). In the former case, as a float, the cutoff frequency should correspond with the half-amplitude point, where the attenuation will be -6dB. In the latter case, the frequencies in cutoff should be positive and monotonically increasing between 0 and fs/2. The values 0 and fs/2 must not be included in cutoff.

ripple: float | None = None#

Upper bound for the deviation (in dB) of the magnitude of the filter’s frequency response from that of the desired filter (not including frequencies in any transition intervals). See scipy.signal.kaiserord for more information.

width: float | None = None#

If width is not None, then assume it is the approximate width of the transition region (expressed in the same units as fs) for use in Kaiser FIR filter design. See scipy.signal.kaiserord for more information.

pass_zero: bool | str = True#

If True, the gain at the frequency 0 (i.e., the “DC gain”) is 1. If False, the DC gain is 0. Can also be a string argument for the desired filter type (equivalent to btype in IIR design functions). {‘lowpass’, ‘highpass’, ‘bandpass’, ‘bandstop’}

wn_hz: bool = True#

Set False if cutoff and width are normalized from 0 to 1, where 1 is the Nyquist frequency

__init__(axis=None, coef_type='ba', cutoff=None, ripple=None, width=None, pass_zero=True, wn_hz=True)#
Parameters:
Return type:

None

kaiser_design_fun(fs, cutoff=None, ripple=None, width=None, pass_zero=True, wn_hz=True)[source]#

Design an order`th-order FIR Kaiser filter and return the filter coefficients. See :obj:`FIRFilterSettings for argument description.

Returns:

The filter taps as designed by firwin

Parameters:
Return type:

tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | None

class KaiserFilterTransformer(*args, **kwargs)[source]#

Bases: FilterByDesignTransformer[KaiserFilterSettings, tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]]]

get_design_function()[source]#

Return a function that takes sampling frequency and returns filter coefficients.

Return type:

Callable[[float], tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], ndarray[tuple[Any, …], dtype[_ScalarT]]] | None]

class KaiserFilter(*args, settings=None, **kwargs)[source]#

Bases: BaseFilterByDesignTransformerUnit[KaiserFilterSettings, KaiserFilterTransformer]

Parameters:

settings (Settings | None)

SETTINGS#

alias of KaiserFilterSettings