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

Function swt

pywt/_swt.py:28–153  ·  view source on GitHub ↗

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 le

(data, wavelet, level=None, start_level=0, axis=-1,
        trim_approx=False, norm=False)

Source from the content-addressed store, hash-verified

26
27
28def swt(data, wavelet, level=None, start_level=0, axis=-1,
29 trim_approx=False, norm=False):
30 """
31 Multilevel 1D stationary wavelet transform.
32
33 Parameters
34 ----------
35 data :
36 Input signal
37 wavelet :
38 Wavelet to use (Wavelet object or name)
39 level : int, optional
40 The number of decomposition steps to perform.
41 start_level : int, optional
42 The level at which the decomposition will begin (it allows one to
43 skip a given number of transform steps and compute
44 coefficients starting from start_level) (default: 0)
45 axis: int, optional
46 Axis over which to compute the SWT. If not given, the
47 last axis is used.
48 trim_approx : bool, optional
49 If True, approximation coefficients at the final level are retained.
50 norm : bool, optional
51 If True, transform is normalized so that the energy of the coefficients
52 will be equal to the energy of ``data``. In other words,
53 ``np.linalg.norm(data.ravel())`` will equal the norm of the
54 concatenated transform coefficients when ``trim_approx`` is True.
55
56 Returns
57 -------
58 coeffs : list
59 List of approximation and details coefficients pairs in order
60 similar to wavedec function::
61
62 [(cAn, cDn), ..., (cA2, cD2), (cA1, cD1)]
63
64 where n equals input parameter ``level``.
65
66 If ``start_level = m`` is given, then the beginning m steps are
67 skipped::
68
69 [(cAm+n, cDm+n), ..., (cAm+1, cDm+1), (cAm, cDm)]
70
71 If ``trim_approx`` is ``True``, then the output list is exactly as in
72 ``pywt.wavedec``, where the first coefficient in the list is the
73 approximation coefficient at the final level and the rest are the
74 detail coefficients::
75
76 [cAn, cDn, ..., cD2, cD1]
77
78 Notes
79 -----
80 The implementation here follows the "algorithm a-trous" and requires that
81 the signal length along the transformed axis be a multiple of ``2**level``.
82 If this is not the case, the user should pad up to an appropriate size
83 using a function such as ``numpy.pad``.
84
85 A primary benefit of this transform in comparison to its decimated

Callers

nothing calls this directly

Calls 3

_as_waveletFunction · 0.85
swt_max_levelFunction · 0.85

Tested by

no test coverage detected