MCPcopy Create free account
hub / github.com/PyWavelets/pywt / idwt2

Function idwt2

pywt/_multidim.py:75–116  ·  view source on GitHub ↗

2-D Inverse Discrete Wavelet Transform. Reconstructs data from coefficient arrays. Parameters ---------- coeffs : tuple (cA, (cH, cV, cD)) A tuple with approximation coefficients and three details coefficients 2D arrays like from ``dwt2``. If any of these

(coeffs, wavelet, mode='symmetric', axes=(-2, -1))

Source from the content-addressed store, hash-verified

73
74
75def idwt2(coeffs, wavelet, mode='symmetric', axes=(-2, -1)):
76 """
77 2-D Inverse Discrete Wavelet Transform.
78
79 Reconstructs data from coefficient arrays.
80
81 Parameters
82 ----------
83 coeffs : tuple
84 (cA, (cH, cV, cD)) A tuple with approximation coefficients and three
85 details coefficients 2D arrays like from ``dwt2``. If any of these
86 components are set to ``None``, it will be treated as zeros.
87 wavelet : Wavelet object or name string, or 2-tuple of wavelets
88 Wavelet to use. This can also be a tuple containing a wavelet to
89 apply along each axis in ``axes``.
90 mode : str or 2-tuple of strings, optional
91 Signal extension mode, see :ref:`Modes <ref-modes>`. This can
92 also be a tuple of modes specifying the mode to use on each axis in
93 ``axes``.
94 axes : 2-tuple of ints, optional
95 Axes over which to compute the IDWT. Repeated elements mean the IDWT
96 will be performed multiple times along these axes.
97
98 Examples
99 --------
100 >>> import numpy as np
101 >>> import pywt
102 >>> data = np.array([[1,2], [3,4]], dtype=np.float64)
103 >>> coeffs = pywt.dwt2(data, 'haar')
104 >>> pywt.idwt2(coeffs, 'haar')
105 array([[ 1., 2.],
106 [ 3., 4.]])
107
108 """
109 # L -low-pass data, H - high-pass data
110 LL, (HL, LH, HH) = coeffs
111 axes = tuple(axes)
112 if len(axes) != 2:
113 raise ValueError("Expected 2 axes")
114
115 coeffs = {'aa': LL, 'da': HL, 'ad': LH, 'dd': HH}
116 return idwtn(coeffs, wavelet, mode, axes)
117
118
119def dwtn(data, wavelet, mode='symmetric', axes=None):

Callers 3

iswt2Function · 0.85
_reconstructMethod · 0.85
waverec2Function · 0.85

Calls 1

idwtnFunction · 0.85

Tested by

no test coverage detected