Skip to content

feat: source-plane fit panel paired to each positions Fit class - #790

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/point-fit-source-plane-panel
Oct 21, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/point-fit-source-plane-panel

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The point-source fit.png gains a "Fit Source Plane ()" panel for every positions fit (1×2; 1×3 with fluxes): the observed positions ray-traced to the point source's own plane, numbered, against the source centre and that plane's caustics, zoomed onto the traced positions with an inset of the whole tangential caustic. It shows how closely the images trace back together — the quantity a source-plane χ² minimises, and the self-consistency check for an image-plane χ².

What the panel draws is paired to the positions Fit class (explicit table, tested for every class in autolens/point/fit/positions/):

Fit class Presentation Centre
FitPositionsImagePair image-plane χ² — context only (no footprints, no χ²) ★ model
FitPositionsImagePairRepeat image-plane χ² — context only ★ model
FitPositionsImagePairRepeatSolved image-plane χ² — context only ◆ solved β*
FitPositionsImagePairAll image-plane χ² — context only ★ model
FitPositionsImagePairAllSolved image-plane χ² — context only ◆ solved β*
FitPositionsSource (weighting="magnification") source-plane χ²: σ/|μ| circle primary + dashed A·σ "propagated noise (reference)"; legend χ² = <value> ★ model
FitPositionsSource (weighting="jacobian") source-plane χ²: A·σ ellipse primary; legend χ² = <value> ★ model
FitPositionsSourceSolved (default jacobian) source-plane χ² of its weighting; legend χ² = <value> ◆ solved β*

Per review, every fit-type cue lives only in the legend: the centre marker (★ "Model source centre" / ◆ "Solved source centre (β*)"), the weighting-specific noise label ("χ² noise σ/|μ|" / "χ² noise A·σ (jacobian)") and a handle-less "χ² = " entry giving only the χ² the fit uses. No subtitles, no χ² box. On the Fit Positions panel, *Solved image-plane fits label their model positions "Model (from solved β*)". Subclasses are presented as their parent; the weighting is read from the fit.

Also:

  • The source-χ² "Model (source plane)" crosses are removed from the image-plane panel (they now live on the source-plane panel).
  • Observed images are numbered 1..N on both panels, in the same order as the PointSolver figure, placed by the label-adjacency helper from feat: PointSolver refinement figure (2×2 + teaching GIF + visualizer output) #788 (moved to positions_panel.adjacent_number_placements_from, shared by both figures).
  • Multi-plane (cluster) points draw the caustics of their own plane (LensCalc.from_tracer(..., plane_i=0, plane_j=plane_index)); the inset frames only the tangential caustic.
  • The panel is NumPy-only (works for use_jax=True fits) and a failure to draw it logs a warning and leaves the panel empty rather than stopping a model-fit.
  • Tick labels at milli-arcsecond zoom rely on fix: adaptive tick significant figures so apply_extent ticks never collapse PyAutoArray#653 adaptive tick rounding (merge that first).

Not changed here: the image-plane "Fit Positions" critical curves of a multi-plane point are still the last plane's (the separate critical-curve redshift draft).

Closes #789.

API Changes

Added a new plotting module and helpers; subplot_fit gains a panel and its flux panel moves from axes[1] to axes[2]. No existing public signatures change.
See full details below.

Test Plan

  • test_autolens/point/plot/test_source_plane_panel.py (new): table covers every positions fit class (7); per-class presentation and centre marker; no subtitle or free-floating fit-type text; legend carries the single χ² value and the weighting-specific label; per-class drawn artists (no footprints / χ² on image-plane fits; circles + dashed ellipses for magnification; solid ellipses for jacobian); drawn noise reproduces the fit's own χ² (magnification and jacobian) and β*; 1×2 / 1×3 layout with the same image numbers on both panels; multi-plane caustics use the point's plane and pre-computed last-plane lines are reused only when the point is in the last plane
  • test_positions_panel.py updated (no source-plane crosses on the image plane; fluxes panel index)
  • full test_autolens: 902 passed, 1 xfailed (with PyAutoArray#653); after the review commit test_autolens/point: 272 passed, 1 xfailed
  • rendered against this branch: autolens_visualization point_source_image_chi_squared, point_source_source_chi_squared, cluster, plus every fit class on the point_source dataset (scratch)
Full API Changes (for automation & release notes)

Added

  • autolens.point.plot.source_plane_panel — SourcePlanePresentation, presentation_table(), presentation_from(fit_positions), SourcePlaneData, source_plane_data_from(fit_positions, numbers=None), traced_positions_from, jacobian_covariances_from, ellipse_from, chi_squared_from, point_plane_caustics_from(tracer, plane_index, grid), caustics_from_lines, zoom_extent_from, ranked_corners_from, chi_squared_label_from, plot_source_plane_panel(ax, data, title, tangential_caustics=None, radial_caustics=None)
  • autolens.point.plot.fit_point_plots.source_plane_caustics_from(fit, solver=None, lines_given=False, source_plane_lines=None, source_plane_line_colors=None)
  • autolens.point.plot.positions_panel — image_order_from, image_numbers_from, model_label_from, adjacent_number_placements_from, plot_image_numbers, box_overlaps_circles, boxes_overlap, NUMBER_PLACEMENTS, MARKER_RADIUS_POINTS, FIT_NUMBER_FONTSIZE

Changed Behaviour

  • fit_point_plots.subplot_fit — adds the "Fit Source Plane" panel (layout 1×2, or 1×3 with fluxes; the fluxes panel is now the third axes); numbers the observed images; uses source_plane_lines for the source-plane panel when the point is in the last plane.
  • positions_panel.plot_fit_model_positions — draws nothing for a source-plane fit (previously "Model (source plane)" crosses on the image plane).
  • point_solver_plots.number_placements_from — delegates to the shared adjacent_number_placements_from (same placements).

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

fit.png gains a 'Fit Source Plane (<name>)' panel for every positions fit
(1x2; 1x3 with fluxes): observed positions traced to the point's own plane,
numbered as on the image plane and the PointSolver figure, against the
source centre and that plane's caustics, with a tangential-caustic inset.

Presentation follows the fit class: image-plane chi-squared fits are context
only (no noise footprints, no chi-squared box); source-plane fits name their
weighting and draw the footprint their chi-squared uses (sigma/|mu| circle
plus dashed A.sigma reference for magnification, A.sigma ellipse for
jacobian) with a chi-squared box; solved fits mark beta* with a diamond.
The source-plane crosses leave the image-plane panel. Closes #789.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jammy2211 and others added 2 commits October 21, 2026 17:47
Per review: remove the panel subtitles and the chi-squared box; the legend
alone carries the fit type (centre marker, weighting-specific noise label,
a handle-less 'chi2 = <value>' entry giving only the chi-squared the fit
uses). The magnification-weighting A.sigma reference ellipses are drawn
dashed in a darker orange so they read on white. Solved image-plane fits
label their model positions 'Model (from solved beta*)'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The all-pairs mixture has no hard pairing, so its residual lines (to the
nearest model position, the dominant term) are dashed and labelled
'Residual (nearest, soft pairing)'; hard-pairing fits keep solid 'Residual'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 826040c into main Oct 21, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/point-fit-source-plane-panel branch October 21, 2026 17:14
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 23, 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.

feat: source-plane fit panel paired to each Fit class

1 participant