Skip to content

Complete the TransformerNUFFT migration: adjoint positional offset and Delaunay parity #326

Description

@Jammy2211

Background

The interferometer NUFFT migration replaced the legacy TransformerNUFFTPyNUFFT (pynufft, with internal Kaiser-Bessel kernel deconvolution in the adjoint) with the new default TransformerNUFFT (nufftax-backed, strict mathematical adjoint). The migration intentionally left the sparse-operator path on TransformerDFT (see the guard in autoarray/dataset/interferometer/dataset.py:261-282), and a recent workspace fix autogalaxy_workspace#90 brought the last outlier script in line with that convention.

However, two diagnostic scripts in autolens_workspace_test are still failing under the new transformer — these are not sparse-path issues, they're library-side correctness gaps in the new adjoint.

Failing scripts

1. NUFFT round-trip peak offset

autolens_workspace_test/scripts/interferometer/nufft.py
AssertionError: Round-trip dirty-image peak too far from original peak: 5.00 px

Repro:

(cd autolens_workspace_test && env PYAUTO_TEST_MODE=2 PYAUTO_SMALL_DATASETS=1 \
  PYAUTO_DISABLE_JAX=1 PYAUTO_FAST_PLOTS=1 JAX_ENABLE_X64=True \
  NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib \
  python3 scripts/interferometer/nufft.py)

A 5-pixel positional offset on round-trip suggests the new nufftax-backed adjoint has a small but real positional convention drift relative to the original TransformerNUFFTPyNUFFT (or relative to TransformerDFT, which the round-trip likely compares against).

2. Delaunay DatasetModel parity

autolens_workspace_test/scripts/multi/dataset_model_parity_delaunay.py
AssertionError: Delaunay A1 != B1: DatasetModel rotation+shift fit differs from profile-baked fit (THIS IS THE BUG THE FIX TARGETS).

Repro:

(cd autolens_workspace_test && env PYAUTO_TEST_MODE=2 PYAUTO_SMALL_DATASETS=1 \
  PYAUTO_DISABLE_JAX=1 PYAUTO_FAST_PLOTS=1 JAX_ENABLE_X64=True \
  NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib \
  python3 scripts/multi/dataset_model_parity_delaunay.py)

The script's own self-comment says "THIS IS THE BUG THE FIX TARGETS" — meaning the script was added specifically to detect this regression and is now asserting against the un-fixed state. PR correlation: fix(interferometer): correct sparse curvature for Pmax > 1 (Delaunay) was meant to address it but left this path broken.

Suspected single root cause

All three Cluster G failures (these two plus the now-fixed workspace apply_sparse_operator case) are downstream of the same upstream issue: the new TransformerNUFFT adjoint's absolute scale and pixel-grid alignment differ from the legacy implementation in ways that the sparse-operator path and the Delaunay parity path both depend on. The workspace fix sidesteps the sparse-path piece by switching to TransformerDFT; this issue is the remaining library-side work to fully complete the migration.

Suggested approach

  1. Quantify the adjoint mismatch: does TransformerNUFFT.image_from(visibilities, use_adjoint_scaling=True) match TransformerDFT.image_from(...) in both scale and pixel position on a simple delta-input test? The error message in apply_sparse_operator implies scale parity is achieved with use_adjoint_scaling=True, but the 5-px round-trip drift suggests a positional/grid-origin convention drift remains.
  2. Reproduce the Delaunay parity failure against the new transformer with print statements at the pre-/post-transformer images to localise the divergence.
  3. Decide whether the fix lives in nufftax's wrapper (PyAutoArray/autoarray/operators/transformer.py:499) or upstream in nufftax itself.

Files of interest

  • PyAutoArray/autoarray/operators/transformer.pyTransformerNUFFT class (lines 499–660+, adjoint scaling notes at 644-653)
  • PyAutoArray/autoarray/dataset/interferometer/dataset.py:261-282 — the deliberate sparse-path guard
  • autolens_workspace_test/scripts/interferometer/nufft.py — round-trip diagnostic
  • autolens_workspace_test/scripts/multi/dataset_model_parity_delaunay.py — parity diagnostic

🤖 Filed via Claude Code as the library-side follow-up to autogalaxy_workspace#90.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions