Repository navigation
feat: source-plane fit panel paired to each positions Fit class - #790
Merged
Merged
Conversation
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>
This was referenced Oct 21, 2026
Merged
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>
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
The point-source
fit.pnggains 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/):FitPositionsImagePairFitPositionsImagePairRepeatFitPositionsImagePairRepeatSolvedFitPositionsImagePairAllFitPositionsImagePairAllSolvedFitPositionsSource(weighting="magnification")χ² = <value>FitPositionsSource(weighting="jacobian")χ² = <value>FitPositionsSourceSolved(default jacobian)χ² = <value>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,
*Solvedimage-plane fits label their model positions "Model (from solved β*)". Subclasses are presented as their parent; the weighting is read from the fit.Also:
PointSolverfigure, placed by the label-adjacency helper from feat: PointSolver refinement figure (2×2 + teaching GIF + visualizer output) #788 (moved topositions_panel.adjacent_number_placements_from, shared by both figures).LensCalc.from_tracer(..., plane_i=0, plane_j=plane_index)); the inset frames only the tangential caustic.use_jax=Truefits) and a failure to draw it logs a warning and leaves the panel empty rather than stopping a model-fit.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_fitgains a panel and its flux panel moves fromaxes[1]toaxes[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 planetest_positions_panel.pyupdated (no source-plane crosses on the image plane; fluxes panel index)test_autolens: 902 passed, 1 xfailed (with PyAutoArray#653); after the review committest_autolens/point: 272 passed, 1 xfailedFull 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_FONTSIZEChanged 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; usessource_plane_linesfor 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 sharedadjacent_number_placements_from(same placements).Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code