Skip to content

BUG: Reject invalid coefficient selectors in downcoef and upcoef - #913

Open
AmanBoronbaev wants to merge 1 commit into
PyWavelets:mainfrom
AmanBoronbaev:check-wavelet-coefficient-selector
Open

AmanBoronbaev wants to merge 1 commit into
PyWavelets:mainfrom
AmanBoronbaev:check-wavelet-coefficient-selector

Conversation

@AmanBoronbaev

Copy link
Copy Markdown

downcoef and upcoef accept 'a' for approximation coefficients and 'd' for detail coefficients. Checking membership in the string 'ad' also accepts '' and 'ad'. Both silently select the detail branch, so an invalid selector can yield plausible numerical output.

Check for membership in the two allowed values and extend the existing error tests to cover both substrings. Before the fix, all four combinations of function and invalid selector produced the same array as 'd'. The full pywt/tests suite passed after the fix (1,052 passed, 2 skipped).

AI assistance: OpenAI Codex prepared the implementation and regression tests and ran the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant