Skip to content

fix bug in iswtn for data of arbitrary shape when using user-specified axes#462

Merged
rgommers merged 2 commits intoPyWavelets:masterfrom
grlee77:iswtn_axis_fix
Feb 18, 2019
Merged

fix bug in iswtn for data of arbitrary shape when using user-specified axes#462
rgommers merged 2 commits intoPyWavelets:masterfrom
grlee77:iswtn_axis_fix

Conversation

@grlee77
Copy link
Copy Markdown
Contributor

@grlee77 grlee77 commented Feb 14, 2019

closes #460

The issue was a variable that should have only contained the shape of the transformed axes and not all axes. This was missed by the current tests because these used the same size on each axis of the transformed array so it didn't matter if the shape from the wrong axis was selected.

A new test case with various permutations of shapes and non-transformed axis was added. Specifically the test case tests the following shape, axes permutations:

shape = (1, 48, 32), axes = [1, 2]
shape = (1, 32, 48), axes = [1, 2]
shape = (48, 1, 32), axes = [0, 2]
shape = (48, 32, 1), axes = [0, 1]
shape = (32, 1, 48), axes = [0, 2]
shape = (32, 48, 1), axes = [0, 1]

@grlee77 grlee77 added the bug label Feb 14, 2019
@grlee77
Copy link
Copy Markdown
Contributor Author

grlee77 commented Feb 18, 2019

i would like to also include this one in the next bug fix release if anyone can do a quick review

@rgommers rgommers merged commit 2e3a224 into PyWavelets:master Feb 18, 2019
@rgommers
Copy link
Copy Markdown
Member

LGTM, merged. Thanks @grlee77

@rgommers
Copy link
Copy Markdown
Member

that was a sloppy bug, makes me wonder if we should do odd shape testing in other functions

@rgommers rgommers added this to the v1.1 milestone Feb 18, 2019
@grlee77
Copy link
Copy Markdown
Contributor Author

grlee77 commented Feb 18, 2019

makes me wonder if we should do odd shape testing in other functions

I think it is already reasonably covered for wavedecn/waverecn. See for example:

def test_wavedecn_shapes_and_size():
wav = pywt.Wavelet('db2')
for data_shape in [(33, ), (64, 32), (1, 15, 30)]:
for axes in [None, 0, -1]:
for mode in pywt.Modes.modes:

and some other tests use odd size and/or a different size per axis.

@grlee77
Copy link
Copy Markdown
Contributor Author

grlee77 commented Feb 18, 2019

thanks for the quick review!

grlee77 added a commit that referenced this pull request Feb 18, 2019
@grlee77 grlee77 deleted the iswtn_axis_fix branch November 13, 2019 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iswtn error when using axes and excluded dim is desn't comply to the level

2 participants