-
-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: add iswtn (n-dimensional inverse SWT) #256
Conversation
Current coverage is 86.96% (diff: 100%)@@ master #256 diff @@
==========================================
Files 20 20
Lines 2910 2962 +52
Methods 0 0
Messages 0 0
Branches 280 297 +17
==========================================
+ Hits 2524 2576 +52
Misses 335 335
Partials 51 51
|
Also from the perspective of symmetry with other functions ( Needs a rebase. |
@@ -167,6 +169,7 @@ def test_swt2_ndim_error(): | |||
assert_raises(ValueError, pywt.swt2, x, 'haar', level=1) | |||
|
|||
|
|||
@dec.slow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have one test not marked as slow for iswt2
and iswtn
? The default for test()
is not to run slow tests, so easy to be developing for some time without running any tests for these functions otherwise.
These do not require a slow decorator, but only test a single wavelet type.
This has now been rebased. I added versions of the 2D and nD tests that just call the existing tests for a single wavelet type so that they are very fast. Most of the other changes in the tests file are minor simplifications: use the kind='discrete' keyword when generating the lists of wavelets to test to avoid the need for type checking later. |
Test failures are unrelated to this PR, due to the new |
Allright, all green after restarting the build now that coverage 4.3.1 is on PyPI. |
Merged, thanks @grlee77! |
In release 0.5.1 there is
swtn
for an n-dimensional forward SWT with flexible choice of axes to transform. This PR provides the corresponding inverse operation,iswtn
.The redundancy of the SWT grows quickly as the number of dimensions (and transform levels) increases, but I think it is still worth having this generalized implementation available.
This logic here may be a bit hard to follow with all the slice objects, use of
itertools.product
for nested loops etc. However, it is a direct extension of the approach used iniswt2
(i.e. combining all possible combinations of odd/even shifts ofidwtn
along the transformed axes). The tests are pretty thorough, so I am fairly confident that the implementation is correct.This makes
iswt2
a bit redundant, but I think keeping a simpler 2D example around serves as a useful reference in understanding the approach behindiswtn
.