ezmsg.sigproc.filterbank#
Functions
- filterbank(kernels, mode=FilterbankMode.CONV, min_phase=MinPhaseMode.NONE, axis='time', new_axis='kernel')[source]#
- Perform multiple (direct or fft) convolutions on a signal using a bank of kernels.
This is intended to be used during online processing, therefore both direct and fft convolutions use the overlap-add method.
Returns:
FilterbankTransformer.- Parameters:
- Return type:
Classes
- class Filterbank(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[FilterbankSettings,AxisArray,AxisArray,FilterbankTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
FilterbankSettings
- class FilterbankMode(*values)[source]#
Bases:
OptionsEnumThe mode of operation for the filterbank.
- CONV = 'Direct Convolution'#
- FFT = 'FFT Convolution'#
- AUTO = 'Automatic'#
- class FilterbankSettings(kernels: list[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]]] | tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], ...], mode: ezmsg.sigproc.filterbank.FilterbankMode = <FilterbankMode.CONV: 'Direct Convolution'>, min_phase: ezmsg.sigproc.filterbank.MinPhaseMode = <MinPhaseMode.NONE: 'No kernel modification'>, axis: str = 'time', new_axis: str = 'kernel')[source]#
Bases:
Settings- Parameters:
- kernels: list[ndarray[tuple[Any, ...], dtype[_ScalarT]]] | tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ...]#
- mode: FilterbankMode = 'Direct Convolution'#
“conv”, “fft”, or “auto”. If “auto”, the mode is determined by the size of the input data. fft mode is more efficient for long kernels. However, fft mode uses non-overlapping windows and will incur a delay equal to the window length, which is larger than the largest kernel. conv mode is less efficient but will return data for every incoming chunk regardless of how small it is and thus can provide shorter latency updates.
- min_phase: MinPhaseMode = 'No kernel modification'#
If not None, convert the kernels to minimum-phase equivalents. Valid options are ‘hilbert’, ‘homomorphic’, and ‘homomorphic-full’. Complex filters not supported. See scipy.signal.minimum_phase for details.
- __init__(kernels, mode=FilterbankMode.CONV, min_phase=MinPhaseMode.NONE, axis='time', new_axis='kernel')#
- class FilterbankState[source]#
Bases:
object- prep_kerns: ndarray[tuple[Any, ...], dtype[_ScalarT]] | list[ndarray[tuple[Any, ...], dtype[_ScalarT]]] | None = None#
- windower: WindowTransformer | None = None#
- mode: FilterbankMode | None = None#
- class FilterbankTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[FilterbankSettings,AxisArray,AxisArray,FilterbankState]
- class MinPhaseMode(*values)[source]#
Bases:
OptionsEnumThe mode of operation for the filterbank.
- NONE = 'No kernel modification'#
- HILBERT = 'Hilbert Method; designed to be used with equiripple filters (e.g., from remez) with unity or zero gain regions'#
- HOMOMORPHIC = 'Works best with filters with an odd number of taps, and the resulting minimum phase filter will have a magnitude response that approximates the square root of the original filter’s magnitude response using half the number of taps'#
- class FilterbankMode(*values)[source]#
Bases:
OptionsEnumThe mode of operation for the filterbank.
- CONV = 'Direct Convolution'#
- FFT = 'FFT Convolution'#
- AUTO = 'Automatic'#
- class MinPhaseMode(*values)[source]#
Bases:
OptionsEnumThe mode of operation for the filterbank.
- NONE = 'No kernel modification'#
- HILBERT = 'Hilbert Method; designed to be used with equiripple filters (e.g., from remez) with unity or zero gain regions'#
- HOMOMORPHIC = 'Works best with filters with an odd number of taps, and the resulting minimum phase filter will have a magnitude response that approximates the square root of the original filter’s magnitude response using half the number of taps'#
- class FilterbankSettings(kernels: list[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]]] | tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], ...], mode: ezmsg.sigproc.filterbank.FilterbankMode = <FilterbankMode.CONV: 'Direct Convolution'>, min_phase: ezmsg.sigproc.filterbank.MinPhaseMode = <MinPhaseMode.NONE: 'No kernel modification'>, axis: str = 'time', new_axis: str = 'kernel')[source]#
Bases:
Settings- Parameters:
- kernels: list[ndarray[tuple[Any, ...], dtype[_ScalarT]]] | tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ...]#
- mode: FilterbankMode = 'Direct Convolution'#
“conv”, “fft”, or “auto”. If “auto”, the mode is determined by the size of the input data. fft mode is more efficient for long kernels. However, fft mode uses non-overlapping windows and will incur a delay equal to the window length, which is larger than the largest kernel. conv mode is less efficient but will return data for every incoming chunk regardless of how small it is and thus can provide shorter latency updates.
- min_phase: MinPhaseMode = 'No kernel modification'#
If not None, convert the kernels to minimum-phase equivalents. Valid options are ‘hilbert’, ‘homomorphic’, and ‘homomorphic-full’. Complex filters not supported. See scipy.signal.minimum_phase for details.
- __init__(kernels, mode=FilterbankMode.CONV, min_phase=MinPhaseMode.NONE, axis='time', new_axis='kernel')#
- class FilterbankState[source]#
Bases:
object- prep_kerns: ndarray[tuple[Any, ...], dtype[_ScalarT]] | list[ndarray[tuple[Any, ...], dtype[_ScalarT]]] | None = None#
- windower: WindowTransformer | None = None#
- mode: FilterbankMode | None = None#
- class FilterbankTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[FilterbankSettings,AxisArray,AxisArray,FilterbankState]
- class Filterbank(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[FilterbankSettings,AxisArray,AxisArray,FilterbankTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
FilterbankSettings
- filterbank(kernels, mode=FilterbankMode.CONV, min_phase=MinPhaseMode.NONE, axis='time', new_axis='kernel')[source]#
- Perform multiple (direct or fft) convolutions on a signal using a bank of kernels.
This is intended to be used during online processing, therefore both direct and fft convolutions use the overlap-add method.
Returns:
FilterbankTransformer.- Parameters:
- Return type: