Repository navigation
Fix spectrogram results on builds without complex numbers - #761
Merged
Merged
Conversation
With ULAB_FFT_IS_NUMPY_COMPATIBLE 1 and ULAB_SUPPORTS_COMPLEX 0, the FFT fills separate real and imaginary arrays, but the magnitude loop read them as interleaved pairs. v923z#694 changed only the FFT guard. Use the same guard for the magnitude loop and the free. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks for catching this! In your comment above you mention that desktop builds fail the same way. Does that mean that the issue is actually not resolved? |
Contributor
Author
|
No, the fix works. "Stock" in that row means without this patch. On cp-desktop-lab, a software emulator of CircuitPython (Linux x86_64, CircuitPython's ulab config), same tree, 3 runs each:
The Metro RP2350 matches: fails without the patch, passes with it. |
Owner
Thanks for the clarification! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
utils.spectrogramreturns wrong values whenULAB_SUPPORTS_COMPLEXis 0.Why
Since #694, the FFT writes one data layout and the magnitude loop reads another.
CircuitPython uses this config, so every CircuitPython build is affected.
Fix
The magnitude loop and the free now use the same
#ifas the FFT.abs(fft)= 3.072e6)abs(fft)Written with Claude Code. I ran the tests above on hardware.
🤖 Generated with Claude Code