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

Function _wavelets_per_axis

pywt/_utils.py:36–69  ·  view source on GitHub ↗

Initialize Wavelets for each axis to be transformed. Parameters ---------- wavelet : Wavelet or tuple of Wavelets If a single Wavelet is provided, it will used for all axes. Otherwise one Wavelet per axis must be provided. axes : list The tuple of axes to be

(wavelet, axes)

Source from the content-addressed store, hash-verified

34
35
36def _wavelets_per_axis(wavelet, axes):
37 """Initialize Wavelets for each axis to be transformed.
38
39 Parameters
40 ----------
41 wavelet : Wavelet or tuple of Wavelets
42 If a single Wavelet is provided, it will used for all axes. Otherwise
43 one Wavelet per axis must be provided.
44 axes : list
45 The tuple of axes to be transformed.
46
47 Returns
48 -------
49 wavelets : list of Wavelet objects
50 A tuple of Wavelets equal in length to ``axes``.
51
52 """
53 axes = tuple(axes)
54 if isinstance(wavelet, (str, Wavelet)):
55 # same wavelet on all axes
56 wavelets = [_as_wavelet(wavelet), ] * len(axes)
57 elif isinstance(wavelet, Iterable):
58 # (potentially) unique wavelet per axis (e.g. for dual-tree DWT)
59 if len(wavelet) == 1:
60 wavelets = [_as_wavelet(wavelet[0]), ] * len(axes)
61 else:
62 if len(wavelet) != len(axes):
63 raise ValueError(
64 "The number of wavelets must match the number of axes "
65 "to be transformed.")
66 wavelets = [_as_wavelet(w) for w in wavelet]
67 else:
68 raise ValueError("wavelet must be a str, Wavelet or iterable")
69 return wavelets
70
71
72def _modes_per_axis(modes, axes):

Callers 11

dwtnFunction · 0.85
idwtnFunction · 0.85
mranFunction · 0.85
iswt2Function · 0.85
swtnFunction · 0.85
iswtnFunction · 0.85
wavedec2Function · 0.85
wavedecnFunction · 0.85
wavedecn_shapesFunction · 0.85
dwtn_max_levelFunction · 0.85
fswavedecnFunction · 0.85

Calls 1

_as_waveletFunction · 0.85

Tested by

no test coverage detected