test: Richardson-step regression asserts; theta_for_beta tol 1e-12 (PyAutoGalaxy#591) - #717
Merged
Merged
Conversation
`test__bug_480_configuration__numpy_richardson_hessian_step_is_too_coarse` was a strict xfail pinning the defect: `LensCalc`'s NumPy Hessian at the last plane of the PyAutoLens#480 configuration returned [-0.00694, -0.00221, 0.00139, 0.00246] against the [0.04508, 0.01099, -0.08602, -0.01118] that exact JAX autodiff and the ray-traced Jacobian agree on. PyAutoGalaxy#591 made the Richardson step adapt per point, so the xfail now XPASSes. It becomes a positive assertion against the ray-traced Jacobian at the same rtol=1e-3 used everywhere else in this module - the tolerance was not widened when the test recorded a disagreement and is not tightened now that it records an agreement. Renamed to `..._numpy_richardson_hessian_agrees_at_the_last_plane`, since the old name states a claim that is no longer true. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzKP1RJKhPrtFmsHSm6EEA
…essian (PyAutoGalaxy#591) `TestTensorVsScalarWeighting`'s ground-truth ray-trace solved `beta_of_theta(theta) == target_beta` with `scipy.optimize.root(method="hybr", tol=1e-14)` and asserted `solution.success`. The jacobian precision tensor's off-diagonal is numerically zero there (1.08e-06 against diagonals 2.04e+06 and 1.00e+04), so the low-precision eigenvector is `(5.3e-13, -1)`; PyAutoGalaxy#591's more accurate Hessian moves those last bits, which moves `target_beta` and with it scipy's termination path. The solver then returns status 3, "xtol too small, no further improvement", at a residual of 8.4e-17 - the root is found to machine precision, only the flag differs. The test's three physics assertions (tensor ordering, scalar ordering, and the true image-plane distances 0.010000 < 0.013505) hold either way. 1e-12 is still far tighter than the 1e-3 scale the test discriminates on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzKP1RJKhPrtFmsHSm6EEA
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.
Summary
Test-only follow-up to PyAutoGalaxy#593 (adaptive Richardson step in
LensCalc's NumPy Hessian, fixing PyAutoGalaxy#591). Two changes:test_autolens/lens/test_multi_plane_cross_validation.py— the strict xfail that pinned the defect on the PyAutoLens#480 fixture now XPASSes; it is converted to a positive regression assertion (renamedtest__bug_480_configuration__numpy_richardson_hessian_agrees_at_the_last_plane): the NumPy Hessian magnification at the last plane matches the ray-traced Jacobian at rtol 1e-3 (agreement measured at 3.4e-4, the stored reference's own precision), with noUserWarning.test_autolens/point/fit/test_solved.py—theta_for_beta'sscipy.optimize.root(..., tol=1e-14)relaxed to1e-12. With the more accurate Hessian, scipy reported status 3 ("xtol too small") at a residual of ~1e-16 — a termination-path artefact, not a physics change; all three physics assertions inTestTensorVsScalarWeightinghold either way. Comment added at the call site.API Changes
None — tests only.
See full details below.
Test Plan
pytest test_autolens/lens/test_multi_plane_cross_validation.py -q→ 17 passed (0 xfail), including under-W error::UserWarningpytest test_autolens -q→ 570 passed, 0 failed against the merged PyAutoGalaxymain, which now carries docs: three-ways-to-learn guide + prune stale API-doc references #593)Full API Changes (for automation & release notes)
Removed
Added
Migration
Refs PyAutoGalaxy#591, PyAutoGalaxy#593.
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WzKP1RJKhPrtFmsHSm6EEA