Skip to content

test: interferometer FD gradient validation (light profiles + sparse rectangular)#158

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/jax-grad-interferometer
Jul 9, 2026
Merged

test: interferometer FD gradient validation (light profiles + sparse rectangular)#158
Jammy2211 merged 1 commit into
mainfrom
feature/jax-grad-interferometer

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Follow-up to the JAX autodiff gradients audit (PyAutoLabs/autolens_workspace_developer#87, user-requested): FD-validate the interferometer likelihood gradients.

Scripts Changed

  • scripts/jax_grad/interferometer.py (new), three variants:
    • A — parametric light profiles: standard lp.Sersic + lp_linear.Sersic source through TransformerDFT — FD-matched ≤ ~1e-6 over all parameters.
    • B — RectangularAdaptDensity + reg.Adapt on the production sparse path (apply_sparse_operator(use_jax=True)): the imaging os_pix=1 staircase applies in full — interferometer pixelization has no over-sampling, so every mass/shear autodiff gradient is correctly ~zero and (with no lens light in the model) there are no usable gradients at all. Assertions encode the staircase so any differentiability change fails loudly.
    • C — RectangularUniform on the same sparse path: all 7 mass/shear gradients live and strictly FD-matched (≤ 2.4e-7) — the gradient-capable mesh for interferometer inference.

Validation

Script runs green from the repo root on CPU JAX (float64), 2026-07-09, against current mains. Heart YELLOW ack carried from the audit ship earlier this session (same pre-existing reasons).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XGDp54jKUd3kUziTF77pNu

… rectangular

Extends the jax_grad FD suite (audit #87 follow-up, user-requested) to the
interferometer likelihood:

- Variant A: parametric source light profiles, standard lp.Sersic +
  lp_linear.Sersic — FD-matched <= ~1e-6 over all params through the
  TransformerDFT visibility transform.
- Variant B: RectangularAdaptDensity + reg.Adapt on the production sparse
  linear-algebra path (apply_sparse_operator(use_jax=True)) — the imaging
  os_pix=1 staircase applies in full (interferometer pixelization has no
  over-sampling, so transform queries always coincide with the rank knots):
  every mass/shear autodiff gradient is correctly ~zero, and with no lens
  light in the model there are no usable gradients at all. Assertions encode
  the staircase so a differentiability change fails loudly.
- Variant C: RectangularUniform on the same sparse path — all 7 mass/shear
  gradients live and strictly FD-matched (<= 2.4e-7); the gradient-capable
  mesh for interferometer inference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGDp54jKUd3kUziTF77pNu
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 9, 2026
@Jammy2211 Jammy2211 merged commit 914041b into main Jul 9, 2026
4 checks passed
@Jammy2211 Jammy2211 deleted the feature/jax-grad-interferometer branch July 9, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant