Skip to content

Zero Nyquist mode in fft to remove oddball rounding artifacts - #98

Draft
Ceyron wants to merge 1 commit into
mainfrom
high-dim-rounding-errors
Draft

Ceyron wants to merge 1 commit into
mainfrom
high-dim-rounding-errors

Conversation

@Ceyron

@Ceyron Ceyron commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Apply the existing oddball_filter_mask inside fft() by default to zero out the Nyquist mode on even grids, removing floating-point artifacts that accumulate in spectral operations (especially in 3D)
  • Add oddball_filter keyword argument (default True) to allow opting out when a faithful transform is needed

Motivation

For even N, the Nyquist mode at k = N/2 accumulates small but non-negligible rounding errors from the FFT butterfly, and spectral derivatives at this mode produce sine components that cannot be represented on the grid. This fix sets in consistently to zero. It remains to be discussed if this is a good choice 🤔.

An alternative is to stick with odd num_points in 3D and in 2D with high resolutions

This branch has not been deployed

No deployments
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