Stationary Wavelet Transform

Stationary Wavelet Transform (SWT), also known as Undecimated wavelet transform or Algorithme à trous is a translation-invariance modification of the Discrete Wavelet Transform that does not decimate coefficients at every transformation level.

Multilevel 1D swt

pywt.swt(data, wavelet, level=None, start_level=0, axis=-1)

Multilevel 1D stationary wavelet transform.

Parameters:

data :

Input signal

wavelet :

Wavelet to use (Wavelet object or name)

level : int, optional

The number of decomposition steps to perform.

start_level : int, optional

The level at which the decomposition will begin (it allows one to skip a given number of transform steps and compute coefficients starting from start_level) (default: 0)

axis: int, optional

Axis over which to compute the SWT. If not given, the last axis is used.

Returns:

coeffs : list

List of approximation and details coefficients pairs in order similar to wavedec function:

[(cAn, cDn), ..., (cA2, cD2), (cA1, cD1)]

where n equals input parameter level.

If start_level = m is given, then the beginning m steps are skipped:

[(cAm+n, cDm+n), ..., (cAm+1, cDm+1), (cAm, cDm)]

Multilevel 2D swt2

pywt.swt2(data, wavelet, level, start_level=0, axes=(-2, -1))

Multilevel 2D stationary wavelet transform.

Parameters:

data : array_like

2D array with input data

wavelet : Wavelet object or name string, or 2-tuple of wavelets

Wavelet to use. This can also be a tuple of wavelets to apply per axis in axes.

level : int

The number of decomposition steps to perform.

start_level : int, optional

The level at which the decomposition will start (default: 0)

axes : 2-tuple of ints, optional

Axes over which to compute the SWT. Repeated elements are not allowed.

Returns:

coeffs : list

Approximation and details coefficients:

[
    (cA_m,
        (cH_m, cV_m, cD_m)
    ),
    (cA_m+1,
        (cH_m+1, cV_m+1, cD_m+1)
    ),
    ...,
    (cA_m+level,
        (cH_m+level, cV_m+level, cD_m+level)
    )
]

where cA is approximation, cH is horizontal details, cV is vertical details, cD is diagonal details and m is start_level.

Multilevel n-dimensional swtn

pywt.swtn(data, wavelet, level, start_level=0, axes=None)

n-dimensional stationary wavelet transform.

Parameters:

data : array_like

n-dimensional array with input data.

wavelet : Wavelet object or name string, or tuple of wavelets

Wavelet to use. This can also be a tuple of wavelets to apply per axis in axes.

level : int

The number of decomposition steps to perform.

start_level : int, optional

The level at which the decomposition will start (default: 0)

axes : sequence of ints, optional

Axes over which to compute the SWT. A value of None (the default) selects all axes. Axes may not be repeated.

Returns:

[{coeffs_level_n}, ..., {coeffs_level_1}]: list of dict

Results for each level are arranged in a dictionary, where the key specifies the transform type on each dimension and value is a n-dimensional coefficients array.

For example, for a 2D case the result at a given level will look something like this:

{'aa': <coeffs>  # A(LL) - approx. on 1st dim, approx. on 2nd dim
 'ad': <coeffs>  # V(LH) - approx. on 1st dim, det. on 2nd dim
 'da': <coeffs>  # H(HL) - det. on 1st dim, approx. on 2nd dim
 'dd': <coeffs>  # D(HH) - det. on 1st dim, det. on 2nd dim
}

For user-specified axes, the order of the characters in the dictionary keys map to the specified axes.

Maximum decomposition level - swt_max_level

pywt.swt_max_level(input_len)

Calculates the maximum level of Stationary Wavelet Transform for data of given length.

Parameters:

input_len : int

Input data length.

Returns:

max_level : int

Maximum level of Stationary Wavelet Transform for data of given length.