You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation for pywt.swt states:
"If start_level = m is given, then the beginning m steps are skipped: [(cAm+n, cDm+n), ..., (cAm+1, cDm+1), (cAm, cDm)]"
It is misleading, because level = n is implied to be positive integer and not non-negative integer, i.e. starts from 1 and not 0.
I provide a counterexample level=1, start_level = 1.
According to documentation, coeffs = [(cA1+1, cD1+1), (cA1, cD1)], len(coeffs) = 2.
In reality, coeffs = [(cA1, cD1)], len(coeffs) = 1.
I suggest removing (cAm, cDm) from documentation or better yet, changing indexes to start from 0 for clarity.
Right now default start_level = 0 corresponds to [(cAn, cDn), ..., (cA2, cD2), (cA**1**, cD**1**)] which is also convoluted and misleading.
The line should read [(cAm+n, cDm+n), ..., (cAm+1, cDm+1)] because minimum n=1.
I agree that changing notation midway is undue. However the fact that start_level starts from 0 and level starts from 1 which corresponds to 2**0 scale bugs me.
The line should read [(cAm+n, cDm+n), ..., (cAm+1, cDm+1)] because minimum n=1.
Ah yes, you are correct - verified by running some code now. If you're interested in opening a PR to fix this, that'd be welcome.
However the fact that start_level starts from 0 and level starts from 1 which corresponds to 2**0 scale bugs me.
Yes I understand that, but we can't really change it for backwards compatibility reasons. The intent of the code reads like the argument name should have been skip_levels rather than start_level.
Activity
rgommers commentedon Feb 20, 2026
Thanks for the report @Smogy001, you are correct that that doesn't look accurate.
This line is wrong:
From a quick look, I think it should read:
I think the subscript
1is used consistently throughout the docs, so this doesn't sound good to me.Smogy001 commentedon Feb 23, 2026
The line should read
[(cAm+n, cDm+n), ..., (cAm+1, cDm+1)]because minimumn=1.I agree that changing notation midway is undue. However the fact that start_level starts from 0 and level starts from 1 which corresponds to 2**0 scale bugs me.
rgommers commentedon Feb 23, 2026
Ah yes, you are correct - verified by running some code now. If you're interested in opening a PR to fix this, that'd be welcome.
Yes I understand that, but we can't really change it for backwards compatibility reasons. The intent of the code reads like the argument name should have been
skip_levelsrather thanstart_level.DOC: fix swt start_level coefficient range in docstring
DOC: fix the swt/swt2 `start_level` coefficient ranges