Skip to content

feat: signed per-image point magnifications + ResultPoint surface (Source & Cluster 5a) - #798

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/point-magnification-signed-surface
Oct 23, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/point-magnification-signed-surface

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #797. Source & Cluster arc phase 5a (epic cluster-strong-lensing).

Summary

PyAutoLens already computes the magnification at every observed image position of a point-source dataset through the multi-plane LensCalc Hessian, but the point fit discarded image parity with abs() before every consumer and the point Result exposed no magnification accessor. This PR:

  • Adds AbstractFitPoint.signed_magnifications_at_positions (raw Hessian value, sign = image parity, aa.ArrayIrregular on NumPy and JAX). magnifications_at_positions is now exactly abs() of it, so flux fitting, magnification weighting and the source-plane panel are numerically unchanged.
  • Adds ResultPoint.signed_magnifications_at_positions and ResultPoint.magnifications_at_positions, read from the max-likelihood FitPointDataset's first present component fit (positions, then flux, then time delays; all evaluate at the same positions with the same tracer). An unpaired dataset raises AttributeError naming the fit type rather than returning None.
  • Docstrings in the fit module and PointDataset state where magnification at a point lives and point to LensCalc.magnification_2d_via_hessian_from for arbitrary (y,x).

The parent prompt's stale Tracer.magnification_2d_from claim in cluster/likelihood_function.py was already gone from source; no edit.

API Changes

  • New AbstractFitPoint.signed_magnifications_at_positions (all point fit classes).
  • New ResultPoint.signed_magnifications_at_positions, ResultPoint.magnifications_at_positions.
  • Unchanged behaviour AbstractFitPoint.magnifications_at_positions still returns |mu|; no consumer, default or config changes. No workspace script, workspace_test script or HowToLens tutorial calls the accessor (grep clean), so no workspace migration is needed. Workspace documentation of magnification at a point (source_science.py both tiers, guides/lens_calc.py, guides/advanced/multi_plane.py, point-source results guide) is the separate phase 5b.

Tests

  • Parity witness (test_autolens/point/fit/test_abstract.py): SIE with supplied positions giving mixed-sign mu (≈ +2.57, −1.2), NumPy and xp=jnp paths, unsigned == abs(signed).
  • Multi-plane witness (test_autolens/point/fit/test_multi_plane_magnification.py): three planes, point source in the middle plane; fit mu equals LensCalc.from_tracer(use_multi_plane=True, plane_j=1) and differs from the final-plane value, so a silent final-plane fallback fails the test.
  • ResultPoint accessors and the unpaired-dataset error (test_autolens/point/model/test_result_point.py).
  • Positions are hand-supplied throughout; no forward PointSolver call (solver boundary approved 2026-10-01).

Validation

  • Full pytest test_autolens: 941 passed, 1 xfailed, 0 failed.
  • pytest test_autolens/point: 308 passed, 1 xfailed.
  • black --check on all changed files passes (repo-wide formatting untouched).
  • Heart at ship: YELLOW (see issue for the acknowledged reasons).

Out of scope: workspace docs (5b), posterior-draw errors (7), maps (8), PointSolver repair (cluster-pointsolver-speed), optimisation/profiling/robustness (separate issues).

🤖 Generated with Claude Code

Add AbstractFitPoint.signed_magnifications_at_positions (Hessian
magnification at each observed position with image parity preserved);
magnifications_at_positions is now exactly abs() of it, so flux fitting,
magnification weighting and the source-plane panel are unchanged.
Expose both on ResultPoint via the max-likelihood FitPointDataset's
component fit. Docstrings state where magnification at a point lives.
Parity and multi-plane plane_j witness tests (supplied positions only).

Source & Cluster arc phase 5a. Closes #797.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Oct 23, 2026
@Jammy2211
Jammy2211 merged commit f791ac7 into main Oct 23, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/point-magnification-signed-surface branch October 23, 2026 11:16
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 23, 2026
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace#598

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.

feat: signed per-image point magnifications + ResultPoint surface (Source & Cluster 5a)

1 participant