Repository navigation
Fix fractal FFT centering for odd and singleton extents - #934
Merged
agianno merged 2 commits intoOct 25, 2026
Merged
Conversation
Member
|
Thanks—the correction looks appropriate. Please add a release note stating that regenerated fractal volumes and rough surfaces with odd-sized or single-cell dimensions may differ for the same seed after this fix. All-even cases and previously exported geometry remain unchanged. This concerns the fractal-generation dimensions, not necessarily the overall domain. Once documented, I’m happy to merge. Please add this compatibility warning to docs/source/release_notes.rst under “Unreleased / next release”, as part of this PR—not only in the PR description. |
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.
Summary
Centre the fractal volume and surface filters on the actual FFT DC position for odd and single-cell extents.
The existing kernels map an index
ito(i + n // 2) % n, so the DC position isn // 2. The callers currently pass a reference atn / 2. For an odd extent this introduces a half-cell offset: conjugate frequency pairs receive different multipliers. Taking the real part of the inverse FFT then changes the intended spectrum. A single-cell axis also incorrectly contributes a nonzero distance to every coefficient.This changes the reference vectors in the volume and surface callers, including their MPI counterparts. The kernels, exponent, output shape, binning and surface-range logic are unchanged.
Regression coverage
(5, 6, 7)and(7, 7, 7), and a single-cell extent(8, 8, 1).(5, 6)and(7, 7), and a single-cell extent(1, 8).Verification
Using the normal source build and pytest configuration on Python 3.12:
test_fractal_volume.py,test_fractal_surface.pyandtest_fractals_generate.pypass.This is not a full-repository, MPI, GPU or hardware test claim. MPI reference-vector changes were checked statically; MPI execution was not available.
Compatibility
Seeded results for odd or single-cell extents change because their spectral distances are corrected. The tested even-extent cases retain exactly the same arrays.
AI assistance
Claude Code prepared the patch and regression tests. Codex independently reproduced the defect, ran the normal-build and paired regression checks, and prepared this PR. No human maintainer approval is implied.