Document when TransformerDFT beats TransformerNUFFT - #498
Merged
Conversation
The transformer-choice block said TransformerNUFFT was "Recommended for any dataset size". Measurement says otherwise below a crossover, and the reason is worth stating because it is not the visibility count on its own. The DFT setup costs O(N_vis x N_pix) against the NUFFT's O((N_vis + N_pix) log N) plus a fixed ~2s overhead, so the product is what decides it. Measured on CPU, the crossover sits near N_vis x N_pix ~ 1e7: the DFT is 0.2-0.7x the NUFFT time below it and the NUFFT is 1.2-1.9x faster above. At a typical 64x64 mask that is ~5,000 visibilities, but on a 32x32 mask the DFT still wins at 4,000 — quoting a visibility count alone would be wrong on half the grids. Past ~1e8 it stops being a speed question: the DFT's allocation grows with the same product and reaches ~109 GB at a million visibilities, where the NUFFT allocates nothing measurable beyond its working buffers. That is why ALMA-scale work uses the NUFFT, and it is what the existing 10,000-visibility DatasetException is really protecting against — now mentioned here along with its opt-out, since a reader hitting that error had nothing pointing at it. Also states plainly that both transformers are supported in the sparse-operator workflow and agree to ~3e-13, which the previous wording left ambiguous. notebooks/ and markdown/ carry the same prose and are regenerated from scripts/ at release time; edited here directly so they are not stale in the interim, in place rather than round-tripped so the diffs stay surgical.
Merged
3 tasks
Merged
2 tasks
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
The transformer-choice block in
scripts/interferometer/start_here.pytold readersTransformerNUFFTwas "Recommended for any dataset size". Measurement says otherwise below a crossover, so this replaces the claim with the actual rule.Companion to PyAutoLabs/PyAutoArray#479, which adds the same guidance library-side.
What the guidance now says
The DFT setup costs
O(N_vis × N_pix)against the NUFFT'sO((N_vis + N_pix) log N)plus a fixed ~2 s overhead — so the product decides which is faster, not the visibility count. Measured on CPU, the crossover sits nearN_vis × N_pix ≈ 1e7: the DFT runs at 0.2–0.7× the NUFFT time below it, and the NUFFT is 1.2–1.9× faster above.At a typical 64×64 mask that's ~5,000 visibilities — but on a 32×32 mask the DFT still wins at 4,000. A visibility-count-only rule would be wrong on half the grids, which is why the prose leads with the product.
Past ~1e8 it stops being a speed question: the DFT's allocation grows with the same product and reaches ~109 GB at a million visibilities, where the NUFFT allocates nothing measurable beyond its working buffers.
Two other things the old wording left out
apply_sparse_operator, agreeing to ~3e-13. The old text implied the DFT was the one for that workflow.DatasetExceptionis now mentioned, with itsraise_error_dft_visibilities_limit=Falseopt-out. A reader who hit that error previously had nothing in the tutorial pointing at it or explaining why it exists.Scripts Changed
scripts/interferometer/start_here.pynotebooks/andmarkdown/carry the same prose and are regenerated fromscripts/at release time; the equivalent edits are applied here directly so they are not stale in the interim. Notebook JSON was edited in place rather than round-tripped, so the diff stays surgical.Test Plan
Generated by Claude Code