Repository navigation
feat: signed per-image point magnifications + ResultPoint surface (Source & Cluster 5a) - #798
Merged
Merged
Conversation
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>
3 of 6 tasks
Collaborator
Author
|
Workspace PR: PyAutoLabs/autolens_workspace#598 |
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.
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
LensCalcHessian, but the point fit discarded image parity withabs()before every consumer and the pointResultexposed no magnification accessor. This PR:AbstractFitPoint.signed_magnifications_at_positions(raw Hessian value, sign = image parity,aa.ArrayIrregularon NumPy and JAX).magnifications_at_positionsis now exactlyabs()of it, so flux fitting, magnification weighting and the source-plane panel are numerically unchanged.ResultPoint.signed_magnifications_at_positionsandResultPoint.magnifications_at_positions, read from the max-likelihoodFitPointDataset's first present component fit (positions, then flux, then time delays; all evaluate at the same positions with the same tracer). An unpaired dataset raisesAttributeErrornaming the fit type rather than returningNone.PointDatasetstate where magnification at a point lives and point toLensCalc.magnification_2d_via_hessian_fromfor arbitrary (y,x).The parent prompt's stale
Tracer.magnification_2d_fromclaim incluster/likelihood_function.pywas already gone from source; no edit.API Changes
AbstractFitPoint.signed_magnifications_at_positions(all point fit classes).ResultPoint.signed_magnifications_at_positions,ResultPoint.magnifications_at_positions.AbstractFitPoint.magnifications_at_positionsstill 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
test_autolens/point/fit/test_abstract.py): SIE with supplied positions giving mixed-sign mu (≈ +2.57, −1.2), NumPy andxp=jnppaths, unsigned == abs(signed).test_autolens/point/fit/test_multi_plane_magnification.py): three planes, point source in the middle plane; fit mu equalsLensCalc.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.ResultPointaccessors and the unpaired-dataset error (test_autolens/point/model/test_result_point.py).Validation
pytest test_autolens: 941 passed, 1 xfailed, 0 failed.pytest test_autolens/point: 308 passed, 1 xfailed.black --checkon all changed files passes (repo-wide formatting untouched).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