Inverse Stationary Wavelet Transform#

Inverse stationary wavelet transforms are provided.

Note: These inverse transforms are not yet optimized for speed. Only, the n-dimensional inverse transform currently has axes support.

Multilevel 1D iswt#

pywt.iswt(coeffs, wavelet, norm=False, axis=-1)#

Multilevel 1D inverse discrete stationary wavelet transform.

Parameters
coeffsarray_like

Coefficients list of tuples:

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

where cA is approximation, cD is details. Index 1 corresponds to start_level from pywt.swt.

waveletWavelet object or name string

Wavelet to use

normbool, optional

Controls the normalization used by the inverse transform. This must be set equal to the value that was used by pywt.swt to preserve the energy of a round-trip transform.

Returns
1D array of reconstructed data.

Examples

>>> import pywt
>>> coeffs = pywt.swt([1,2,3,4,5,6,7,8], 'db2', level=2)
>>> pywt.iswt(coeffs, 'db2')
array([ 1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.])

Multilevel 2D iswt2#

pywt.iswt2(coeffs, wavelet, norm=False, axes=(-2, -1))#

Multilevel 2D inverse discrete stationary wavelet transform.

Parameters
coeffslist

Approximation and details coefficients:

[
    (cA_n,
        (cH_n, cV_n, cD_n)
    ),
    ...,
    (cA_2,
        (cH_2, cV_2, cD_2)
    ),
    (cA_1,
        (cH_1, cV_1, cD_1)
    )
]

where cA is approximation, cH is horizontal details, cV is vertical details, cD is diagonal details and n is the number of levels. Index 1 corresponds to start_level from pywt.swt2.

waveletWavelet object or name string, or 2-tuple of wavelets

Wavelet to use. This can also be a 2-tuple of wavelets to apply per axis.

normbool, optional

Controls the normalization used by the inverse transform. This must be set equal to the value that was used by pywt.swt2 to preserve the energy of a round-trip transform.

Returns
2D array of reconstructed data.

Examples

>>> import pywt
>>> coeffs = pywt.swt2([[1,2,3,4],[5,6,7,8],
...                     [9,10,11,12],[13,14,15,16]],
...                    'db1', level=2)
>>> pywt.iswt2(coeffs, 'db1')
array([[  1.,   2.,   3.,   4.],
       [  5.,   6.,   7.,   8.],
       [  9.,  10.,  11.,  12.],
       [ 13.,  14.,  15.,  16.]])

Multilevel n-dimensional iswtn#

pywt.iswtn(coeffs, wavelet, axes=None, norm=False)#

Multilevel nD inverse discrete stationary wavelet transform.

Parameters
coeffslist

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

waveletWavelet 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.

axessequence of ints, optional

Axes over which to compute the inverse SWT. Axes may not be repeated. The default is None, which means transform all axes (axes = range(data.ndim)).

normbool, optional

Controls the normalization used by the inverse transform. This must be set equal to the value that was used by pywt.swtn to preserve the energy of a round-trip transform.

Returns
nD array of reconstructed data.

Examples

>>> import pywt
>>> coeffs = pywt.swtn([[1,2,3,4],[5,6,7,8],
...                     [9,10,11,12],[13,14,15,16]],
...                    'db1', level=2)
>>> pywt.iswtn(coeffs, 'db1')
array([[  1.,   2.,   3.,   4.],
       [  5.,   6.,   7.,   8.],
       [  9.,  10.,  11.,  12.],
       [ 13.,  14.,  15.,  16.]])