Stationary Wavelet Transform (SWT)

Contents

Stationary Wavelet Transform (SWT)#

ptwt.swt(data: Tensor, wavelet: Wavelet | str, level: int | None = None, axis: int = -1) list[Tensor][source]#

Compute a multilevel 1d stationary wavelet transform.

This fuctions is equivalent to pywt’s pywt.swt() with trim_approx=True and norm=False.

Parameters:
  • data (torch.Tensor) – The input time series to transform. By default the last axis is transformed.

  • wavelet (Wavelet or str) – A pywt wavelet compatible object or the name of a pywt wavelet. Refer to the output from pywt.wavelist(kind='discrete') for possible choices.

  • level (int, optional) – The maximum decomposition level. If None, the level is computed based on the signal shape. Defaults to None.

  • axis (int) – Compute the transform over this axis of the data tensor. Defaults to -1.

Returns:

Same as wavedec(). Equivalent to pywt.swt() with trim_approx=True.

ptwt.iswt(coeffs: Sequence[Tensor], wavelet: Wavelet | str, axis: int = -1) Tensor[source]#

Invert a 1d stationary wavelet transform.

Parameters:
  • coeffs – The wavelet coefficient sequence produced by the forward transform swt(). See ptwt.constants.WaveletCoeff1d.

  • wavelet (Wavelet or str) – A pywt wavelet compatible object or the name of a pywt wavelet, as used in the forward transform.

  • axis (int) – Compute the transform over this axis of the data tensor. Defaults to -1.

Returns:

A reconstruction of the original swt() input.