Skip to content

BUG: fix indexing in WaveletPacketND.reconstruct for data_size - #857

Merged
rgommers merged 2 commits into
PyWavelets:mainfrom
whyvineet:fix/waveletpacketnd-reconstruct-indexing
Aug 13, 2026
Merged

BUG: fix indexing in WaveletPacketND.reconstruct for data_size#857
rgommers merged 2 commits into
PyWavelets:mainfrom
whyvineet:fix/waveletpacketnd-reconstruct-indexing

Conversation

@whyvineet

Copy link
Copy Markdown
Contributor

When using WaveletPacketND.reconstruct() to reconstruct the array, it may be necessary to trim it so that it matches the original shape. In order to prevent an IndexError, tuple-based slicing should be used rather than list-based indexing.

Fixes #856

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @whyvineet. This does look correct and fixes the reported issue.

This code used to be correct once upon a time it looks like; numpy warned on and then changed its behavior for this non-tuple case:

FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated

@rgommers rgommers added the bug label Aug 13, 2026
@rgommers rgommers added this to the v1.10.0 milestone Aug 13, 2026
@rgommers
rgommers merged commit 10ecbd3 into PyWavelets:main Aug 13, 2026
14 of 17 checks passed
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.

WaveletPacketND.reconstruct() raises IndexError for non-power-of-two shapes

2 participants