pysdkit.ewt#

Created on 2024/7/12 13:41 @author: Whenxuan Wang @email: wwhenxuan@gmail.com

pysdkit._ewt.ewt(signal[, K, log, detect, ...])

Empirical Wavelet Transform with Function Interface.

ewt.ewt#

Created on 2024/7/12 13:41 @author: Whenxuan Wang @email: wwhenxuan@gmail.com Empirical Wavelet Transform for 1D signals

Original paper: Gilles, J., 2013. Empirical Wavelet Transform. IEEE Transactions on Signal Processing, 61(16), pp.3999-4010. Available at: https://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=6522142. Original Matlab toolbox: https://www.mathworks.com/matlabcentral/fileexchange/42141-empirical-wavelet-transforms Original Code from: vrcarva/ewtpy

pysdkit._ewt.ewt.ewt(signal: ndarray, K: int | None = 5, log: float | None = 0, detect: str | None = 'locmax', completion: float | None = 0, reg: str | None = 'average', lengthFilter: float | None = 10, sigmaFilter: float | None = 5, return_all: bool | None = False)[source]#

Empirical Wavelet Transform with Function Interface.

Parameters:
  • signal – The input signal to be decomposed.

  • K – Maximum number of modes (signal components) to detect and extract.

  • log – Set to 0 or 1 to indicate whether to work with the logarithmic spectrum.

  • detect – Method for detecting boundaries in the Fourier domain (‘locmax’ or other methods).

  • completion – Set to 0 or 1 to indicate whether to complete the number of modes to K if fewer are detected.

  • reg – Regularization method applied to the filter bank (‘none’, ‘gaussian’, or ‘average’).

  • lengthFilter – Width of the filters used in regularization (for Gaussian or average filters).

  • sigmaFilter – Standard deviation for the Gaussian filter in the regularization step.

  • return_all – If True, return the EWT decomposition, the filter bank, and the boundaries. If False, return only the EWT decomposition.

Returns:

  • _ewt - The extracted modes from the signal.

  • mfb: The filter bank in the Fourier domain (only if return_all is True).

  • boundaries: Boundaries detected in the Fourier spectrum (only if return_all is True).

class pysdkit._ewt.ewt.EWT(K: int | None = 5, log: float | None = 0, detect: str | None = 'locmax', completion: float | None = 0, reg: str | None = 'average', lengthFilter: float | None = 10, sigmaFilter: float | None = 5)[source]#

Bases: object

Empirical Wavelet Transform with Class Interface.

Gilles, J., 2013. Empirical Wavelet Transform. IEEE Transactions on Signal Processing, 61(16), pp.3999–4010.

Paper link: https://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=6522142. Python code: vrcarva/ewtpy MATLAB code: https://www.mathworks.com/matlabcentral/fileexchange/42141-empirical-wavelet-transforms

__call__(signal: ndarray, N: int | None = None, return_all: bool | None = False) Tuple[ndarray, ndarray, ndarray] | ndarray[source]#

allow instances to be called like functions

__init__(K: int | None = 5, log: float | None = 0, detect: str | None = 'locmax', completion: float | None = 0, reg: str | None = 'average', lengthFilter: float | None = 10, sigmaFilter: float | None = 5) None[source]#
Parameters:
  • K – Maximum number of modes (signal components) to detect and extract.

  • log – Set to 0 or 1 to indicate whether to operate in the logarithmic spectrum.

  • detect – Method for detecting boundaries in the Fourier domain (‘locmax’ or other detection methods).

  • completion – Set to 0 or 1 to indicate whether to complete the number of modes to K if fewer are detected.

  • reg – Regularization method applied to the filter bank (‘none’, ‘gaussian’, or ‘average’).

  • lengthFilter – Width of the filters used in regularization (for Gaussian or average filters).

  • sigmaFilter – Standard deviation for the Gaussian filter in the regularization step.

__module__ = 'pysdkit._ewt.ewt'#
__str__() str[source]#

Get the full name and abbreviation of the algorithm

__weakref__#

list of weak references to the object (if defined)

fit_transform(signal: ndarray, N: int | None = None, return_all: bool | None = False) Tuple[ndarray, ndarray, ndarray] | ndarray[source]#

Perform Empirical Wavelet Transform on the input signal.

Parameters:
  • signal – Input signal array to be decomposed.

  • N – Number of modes to extract. Defaults to the value specified during initialization.

  • return_all – If True, return the EWT decomposition, the filter bank, and the boundaries. If False, return only the EWT decomposition.

Returns:

  • _ewt: The extracted modes from the signal.

  • mfb: The filter bank applied in the Fourier domain (only if return_all is True).

  • boundaries: Boundaries detected in the Fourier spectrum (only if return_all is True).

static fmirror(ts: ndarray, sym: int, end: int) ndarray[source]#

Implements a signal mirroring expansion function.