Skip to content

Raise informative errors for CWT misuse instead of opaque crashes - #171

Merged
cboulay merged 1 commit into
devfrom
fix-41-cwt-informative-errors
Jul 8, 2026
Merged

Raise informative errors for CWT misuse instead of opaque crashes#171
cboulay merged 1 commit into
devfrom
fix-41-cwt-informative-errors

Conversation

@cboulay

@cboulay cboulay commented Jul 8, 2026

Copy link
Copy Markdown
Member

Closes #41.

Both failure modes from the issue are unchanged in current code and fail deep inside internals with messages that don't point at the actual problem. This PR adds two early guards:

  1. CWTTransformer rejects input that already carries a freq dim. Previously this crashed in AxisArray with dims contains repeated dim names; now it explains that CWT appends a freq axis and expects time-domain input.
  2. filterbank rejects complex kernels when min_phase != NONE. Previously scipy raised a bare Complex filters not supported; now the error explains that scipy.signal.minimum_phase only accepts real filters, so complex/analytic wavelets (e.g. cmor) cannot be min-phased — use MinPhaseMode.NONE or a real wavelet.

Both scenarios from the original report have regression tests.

Closes #41. Two guards:
- CWTTransformer rejects input that already carries a 'freq' dim, instead of
  failing inside AxisArray with 'dims contains repeated dim names'.
- filterbank rejects complex kernels when min_phase != NONE, explaining that
  scipy.signal.minimum_phase only supports real filters (so complex/analytic
  wavelets like 'cmor' cannot be min-phased), instead of scipy's bare
  'Complex filters not supported'.
@cboulay
cboulay merged commit 695462c into dev Jul 8, 2026
25 of 26 checks passed
@cboulay
cboulay deleted the fix-41-cwt-informative-errors branch July 8, 2026 05:43
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.

An error occurred when using wavelet ezmsg.sigproc.wavelets.cwt

1 participant