Skip to content

docs: multi_plane guide — Richardson section shows the adaptive-step fix #623

Closed

Description

@Jammy2211

Overview

scripts/guides/advanced/multi_plane.py has a section, added in #517, titled "A Warning: The NumPy Hessian Step Is Too Coarse Near A Compact Deflector". It runs LensCalc.magnification_2d_via_hessian_from live on the PyAutoLens#480 fixture and says the defect is filed and not fixed. PyAutoGalaxy#591 / PR#593 made _hessian_via_richardson adaptive. Against the released autogalaxy (2026.11.7.1), the live printout now agrees with the oracles, so the prose is wrong.

Plan

  • Rewrite the section as "what used to fail, and how the adaptive step handles it".
  • Keep the live evaluation, which now demonstrates the fix, and print residuals against autodiff and the ray-traced Jacobian.
  • Quote the old wrong numbers [-0.00694, -0.00221, 0.00139, 0.00246] as history.
  • Explain the two termination rules (tolerance rtol=1e-7, roundoff floor) and the UserWarning contract: only genuinely singular points warn.
  • Drop the "not fixed" sentence and the PyAutoMind bug-prompt pointer, and point at PyAutoGalaxy#593 instead.
  • Regenerate notebooks/guides/advanced/multi_plane.ipynb and run the guide through the runner.
Detailed plan
  1. Replace the __A Warning: ...__ markdown and the trailing "known, filed defect" paragraph (about lines 1259-1310) with a short history-plus-mechanism section. The rules come from the installed _hessian_via_richardson docstring:
    • Tolerance: successive extrapolants agree to atol + rtol*|R|.
    • Roundoff floor: the change grows while it is already below roundoff_guard=1e-4.
    • Neither rule warns. A point that is still refining after max_halvings keeps its last value and triggers a single UserWarning. Nothing raises.
  2. Extend the live code cell to print the Hessian, the autodiff and ray-traced values, and the max relative residual against each.
  3. Keep the closing "every arm is a few lines long" paragraph and the Attribution section unchanged.
  4. Regenerate the notebook cells for the edited section.
  5. Run the script through PyAutoHands run_python.py, using the profile_smoke.yaml and ENV: jax full_datasets env. Run the notebook code too.

Tier: notify — merge mode: human /prm (batch 2026-11-08-am contract: ends at PR-open)

Activity

  1. Jammy2211 commented on Nov 8, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped in #624 (merged as a78405d, all 8 checks green). The multi_plane guide's Richardson section now demonstrates the PyAutoGalaxy#593 adaptive-step fix live: residual vs autodiff 1.6e-7, vs ray-traced Jacobian 1.5e-4. The old numbers are quoted as history.

    Open caveat: the notebook was patched cell-wise instead of through generate.py. The next full regeneration should produce no diff here, but it is worth confirming.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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