Skip to content

feat: potential corrections for interferometer data (visibility-space al.pc) #623

Description

@Jammy2211

Overview

Extend the potential-correction (gravitational imaging) subpackage al.pc (shipped in #618; ported from Cao et al. 2025, https://github.com/caoxiaoyue/lensing_potential_correction, cite via https://github.com/caoxiaoyue/potential_correction_paper) from Imaging to Interferometer datasets, fitting in visibility space. This reaches the technique's benchmark regime: the JVAS B1938+666 detections of Powell et al. 2025 (Nat. Astron. 9, 1714) and Vegetti et al. 2026 were made with a visibility-space gravitational-imaging code.

Plan

  • New visibility-space fits in al.pc: FitDpsiInterferometer (δψ-only inversion of a visibility residual) and FitDpsiSrcInterferometer (joint source+δψ), where the correction response is −T(D_s·D_ψ) via transformer.transform_mapping_matrix (already xp-parameterized) in place of the imaging PSF blur matrix B; real/imag block stacking and complex-noise handling mirror the existing interferometer inversion conventions (noise_normalization_complex_from).
  • δψ mesh built from the dataset's real-space mask (cleaned), reusing PairRegularDpsiMesh unchanged; source gradients remain image-plane (ray-traced real-space grid).
  • Iterative engine support: the per-step source-mapping update uses the transformed mapping matrix instead of convolved_mapping_matrix_from; IterFitDpsiSrcInterferometer (or dataset-dispatching extension of the existing engine — decided in implementation by whichever mirrors the FitImaging/FitInterferometer split most cleanly).
  • Analysis classes for evidence-based hyper-parameter sampling over interferometer data.
  • al.pc.dense_util untouched — its xp kernels are data-agnostic (mapping matrix + noise vector in).
  • Workspace follow-up (library-first gate): autolens_workspace_test scripts — jax_likelihood_functions/interferometer/potential_correction.py (xp/jit parity on the visibility evidence) and an interferometer subhalo_recovery regression (SimulatorInterferometer + NFW subhalo), smoke-wired.
  • NumPy-first; JAX rides the transformer's existing xp support. Unit tests numpy-only. Citations maintained in all new modules.
Detailed implementation plan

Affected Repositories

  • PyAutoLens (primary)
  • autolens_workspace_test (workspace follow-up)

Work Classification

Both (library first, workspace follows)

Branch Survey

Repository Current Branch Dirty?
./PyAutoLens main 1 file (paper_jax/paper.md, unrelated JOSS draft — warning only)
./autolens_workspace_test main clean

Suggested branch: feature/potential-correction-interferometer
Worktree root: ~/Code/PyAutoLabs-wt/potential-correction-interferometer/

Implementation Steps

  1. autolens/potential_correction/fit_interferometer.py: FitDpsiInterferometer + FitDpsiSrcInterferometer.
    • Correction response: densify D_s @ D_ψ (sparse product, then .toarray()), apply dataset.transformer.transform_mapping_matrix → complex [n_vis, n_dpsi]; stack real/imag rows to match how the interferometer inversion's operated_mapping_matrix enters the curvature (mirror autoarray/inversion/inversion/interferometer/abstract.py::operated_mapping_matrix_list exactly).
    • Source blocks from al.FitInterferometer's inversion (operated_mapping_matrix, regularization_matrix) at the smooth starting model, as the imaging fit does with FitImaging.
    • Noise: per-component inverse variance from the complex noise map; evidence noise term via aa.util.fit.noise_normalization_complex_from; χ² over real+imag residuals.
    • δψ mesh: PairRegularDpsiMesh(real_space_mask, pixel_scale, factor); δψ regularization via the existing DpsiLinearObj adapter.
  2. autolens/potential_correction/iterative.py: dataset seam — replace the imaging-only psf.convolved_mapping_matrix_from update and psf_matrix property with a dispatch on dataset type (imaging → PSF matrix path; interferometer → transform_mapping_matrix path); gauge constraints and LM kernels unchanged.
  3. autolens/potential_correction/analysis.py: DpsiInvInterferometerAnalysis / DpsiSrcInvInterferometerAnalysis (or dataset-generic analyses — implementation judgment).
  4. Exports in autolens/potential_correction/__init__.py + docs/api page update.
  5. Unit tests (numpy-only): matrix-injection evidence-term tests for the complex-noise formulation; end-to-end finite evidence on the interferometer_7 fixture family; transformed-response shape/consistency vs direct transformer.visibilities_from on a δ-function correction.
  6. Workspace step (after library PR): the two autolens_workspace_test scripts + smoke_tests.txt/env_vars.yaml wiring, mirroring the imaging ones.

Key Files

  • autolens/potential_correction/{fit.py,iterative.py,analysis.py,dense_util.py} — the imaging implementations being extended.
  • autoarray/operators/transformer.pytransform_mapping_matrix(mapping_matrix, xp=np) (DFT + NUFFT variants).
  • autoarray/inversion/inversion/interferometer/abstract.py — the operated-mapping-matrix conventions to mirror.
  • autoarray/fit/fit_util.py::noise_normalization_complex_from — the visibility noise term.

Original Prompt

Click to expand starting prompt

merge, and then the follow up will be to get this running on interferometer data as currently its just imaging

Prompt file: PyAutoMind/active/potential_correction_interferometer.md

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