Skip to content

Commit 6031ddf

Browse files
authored
Merge pull request #863 from rgommers/doc/fix-swt-start-level-formula
DOC: fix the swt/swt2 `start_level` coefficient ranges
2 parents b5087c2 + af82191 commit 6031ddf

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

pywt/_swt.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ def swt(data, wavelet, level=None, start_level=0, axis=-1,
4141
start_level : int, optional
4242
The level at which the decomposition will begin (it allows one to
4343
skip a given number of transform steps and compute
44-
coefficients starting from start_level) (default: 0)
44+
coefficients starting from start_level) (default: 0). The output
45+
always contains exactly ``level`` sets of coefficients, corresponding
46+
to decomposition levels ``start_level + 1`` through
47+
``start_level + level``.
4548
axis: int, optional
4649
Axis over which to compute the SWT. If not given, the
4750
last axis is used.
@@ -66,7 +69,7 @@ def swt(data, wavelet, level=None, start_level=0, axis=-1,
6669
If ``start_level = m`` is given, then the beginning m steps are
6770
skipped::
6871
69-
[(cAm+n, cDm+n), ..., (cAm+1, cDm+1), (cAm, cDm)]
72+
[(cAm+n, cDm+n), ..., (cAm+1, cDm+1)]
7073
7174
If ``trim_approx`` is ``True``, then the output list is exactly as in
7275
``pywt.wavedec``, where the first coefficient in the list is the
@@ -165,7 +168,7 @@ def iswt(coeffs, wavelet, norm=False, axis=-1):
165168
[(cAn, cDn), ..., (cA2, cD2), (cA1, cD1)]
166169
167170
where cA is approximation, cD is details. Index 1 corresponds to
168-
``start_level`` from ``pywt.swt``.
171+
``start_level + 1`` from ``pywt.swt``.
169172
wavelet : Wavelet object or name string
170173
Wavelet to use
171174
norm : bool, optional
@@ -309,9 +312,6 @@ def swt2(data, wavelet, level, start_level=0, axes=(-2, -1),
309312
...,
310313
(cA_m+1,
311314
(cH_m+1, cV_m+1, cD_m+1)
312-
),
313-
(cA_m,
314-
(cH_m, cV_m, cD_m)
315315
)
316316
]
317317
@@ -327,7 +327,6 @@ def swt2(data, wavelet, level, start_level=0, axes=(-2, -1),
327327
(cH_m+level, cV_m+level, cD_m+level),
328328
...,
329329
(cH_m+1, cV_m+1, cD_m+1),
330-
(cH_m, cV_m, cD_m),
331330
]
332331
333332
Notes
@@ -402,7 +401,7 @@ def iswt2(coeffs, wavelet, norm=False, axes=(-2, -1)):
402401
403402
where cA is approximation, cH is horizontal details, cV is
404403
vertical details, cD is diagonal details and n is the number of
405-
levels. Index 1 corresponds to ``start_level`` from ``pywt.swt2``.
404+
levels. Index 1 corresponds to ``start_level + 1`` from ``pywt.swt2``.
406405
wavelet : Wavelet object or name string, or 2-tuple of wavelets
407406
Wavelet to use. This can also be a 2-tuple of wavelets to apply per
408407
axis.

0 commit comments

Comments
 (0)