Skip to content

test: migrate jax_grad scripts to consolidated rectangular meshes - #209

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/rectangular-mesh-consolidation
Jul 23, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/rectangular-mesh-consolidation

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Migrates the two jax_grad certification scripts to the consolidated rectangular meshes (PyAutoLabs/PyAutoArray#403, merged): the plain names RectangularAdaptDensity / RectangularAdaptImage are now the kernel-density-CDF meshes, and the RectangularKernel* names plus the old linear empirical-CDF path no longer exist — these scripts were the only two files in any workspace importing the removed names.

  • scripts/jax_grad/imaging_pixelization.py: the old linear variants B/C/D (staircase invariance at os=1; 5%-tolerance FD at os=4) are retired — the staircase they documented was deleted with the linear mesh, exactly as variant B's docstring said would happen ("a future library change... will fail loudly — update it"). The kernel variants E/F/G become variants B/C/D under the plain names, keeping strict FD-step-sweep assertions on ALL parameters at os=1, os=4 and the full production shape, the mass/shear-live checks, and the documented os=1 Einstein-radius branch-flip exclusion.
  • scripts/jax_grad/interferometer.py: the old variant B (linear staircase — all gradients correctly ~zero, "no usable gradients") is retired and the kernel variant D becomes variant B under the plain name: strict FD on every parameter on the sparse-operator path. Variant A (parametric) and C (uniform) unchanged.
  • The FoM-parity assertions vs the linear mesh are retired with their reference implementation — the historical parity measurements (2.7e-5–6.3e-4 relative) remain recorded in the gradient-audit README.

Scripts Changed

  • scripts/jax_grad/imaging_pixelization.py
  • scripts/jax_grad/interferometer.py

Test Plan

  • python scripts/jax_grad/imaging_pixelization.py — all variants pass (strict FD, eager-vs-JIT consistency, mass/shear live)
  • python scripts/jax_grad/interferometer.py — all variants pass

Library PR: PyAutoLabs/PyAutoArray#403 (merged). Part of PyAutoLabs/PyAutoArray#402.

Note: this repo is concurrently claimed by env-declaration-docstring-form (PyAutoHands#189) — this PR deliberately touches ONLY the two jax_grad scripts (claim override user-authorized 2026-07-23); the # ENV: declaration lines in both files are preserved byte-for-byte.

Generated by the PyAutoLabs agent workflow.

RectangularAdaptDensity/AdaptImage are now the kernel-CDF meshes
(PyAutoArray#403); the RectangularKernel* names and the linear
empirical-CDF path are gone. Linear staircase variants retired; kernel
variants take the plain names with strict FD-step-sweep assertions on
all parameters (os=1, os=4, production shape, interferometer sparse).
FoM-parity assertions retired with their linear reference. Both scripts
re-certified passing. ENV declaration lines untouched.

Part of PyAutoLabs/PyAutoArray#402.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XK2ZZagTywsBZC4CZL66eB
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 23, 2026
The plain-name meshes' numerics shifted with PyAutoArray#403 (linear →
kernel CDF): rectangular.py and rectangular_mge.py improve at the default
bandwidth and get their measured values; rectangular_dspl.py is
bandwidth-sensitive (default over-smooths its adapt-image weights,
LL -6340 vs -3824 at 0.1) so it pins bandwidth=0.1, documented in-line.
Interferometer references unchanged (pass within tolerance). All seven
scripts verified green. Follow-up research prompt filed on bandwidth
defaults (Mind draft/research/autoarray/rectangular_kernel_bandwidth_defaults.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XK2ZZagTywsBZC4CZL66eB
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Second commit ef297b6 fixes the smoke failure the first CI run caught: jax_likelihood_functions/imaging/rectangular*.py assert hard-coded reference LLs computed with the deleted linear mesh. Re-derived under the kernel meshes: rectangular.py −651,693 → −644,121 and rectangular_mge.py −82.9 → −9.1 (both improvements at the default bandwidth); rectangular_dspl.py is bandwidth-sensitive (default over-smooths its adapt-image weights: −6,340) so it pins bandwidth=0.1 (−3,824, ≈ the old linear −3,696) with an in-line rationale. Interferometer references pass unchanged. All 7 scripts verified green locally; follow-up research prompt filed on bandwidth defaults.

… the jax_grad rewrite

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XK2ZZagTywsBZC4CZL66eB
@Jammy2211
Jammy2211 merged commit 95cca5f into main Jul 23, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/rectangular-mesh-consolidation branch July 24, 2026 08:48
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant