test: interferometer FD gradient validation (light profiles + sparse rectangular)#158
Merged
Merged
Conversation
… 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
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.
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:lp.Sersic+lp_linear.Sersicsource throughTransformerDFT— FD-matched ≤ ~1e-6 over all parameters.RectangularAdaptDensity+reg.Adapton 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.RectangularUniformon 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