Repository navigation
feat: PointSolver refinement figure (2×2 + teaching GIF + visualizer output) - #788
Merged
Merged
Conversation
…zer output) - autolens/point/plot/point_solver_plots.py: point_solver.png (steps 0, 1, 2 and final on one fixed extent; tested / kept / kept-then-rejected / neighbours / up-sampled triangles, critical curve, observed and solved positions, step-0 numbering + rejected annotation, arcsec ticks via apply_extent, centroid markers for sub-pixel kept triangles) and a looping GIF (PillowWriter, one step per frame, final held 3x) sharing one per-panel draw function. - aplt.plot_point_solver(solver, tracer, source_plane_coordinate, ..., animate=False). - PlotterPoint.point_solver + VisualizerPoint (best fit, full visualization only) behind fit_point_dataset: subplot_point_solver (default false); NumPy re-solve; warns when a step keeps nearly MAX_CONTAINING_SIZE triangles. - Step.tree_flatten returns plane_triangles (6 children for 6 fields). - Remove the unused debug autolens/point/visualise.py (transposed, plt.show only). - Thinner, smaller model cross in the Fit Positions panel so the observed dot stays visible. Closes #787 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 2026
Merged
…d note in a corner Each step-0 image number is placed a few points off its own image (one of four fixed offsets, the first inside the panel and clear of other markers/numbers), never moved away by a global search. Several rejected candidates (or one with no clear spot beside it) get one label in the emptiest axes corner with one arrow per candidate, chosen to avoid covering/crossing images. Tests assert each number's box is within 10 pt of its image, including a crowded layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
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
Phase 2 of the point-source figures (#787): a
point_solver.pngfigure showing how thePointSolverrefines its triangle tiling onto the multiple images, a teaching GIF in the same style, and an optional visualizer output during modelling. It is both a modelling diagnostic (did the grid cover every image, how many triangles survive each step) and teaching material.variant_f_coarsestyle: tested triangles grey, kept blue, kept-then-rejected (μ <magnification_threshold) hatched muted blue, neighbour rim orange, up-sampled green, purple critical curve, observed hollow circles, solved red ✕. Step 0 numbers the images and labels the rejected candidate. Kept triangles under ~3 screen pixels are drawn as a centroid ▲ ("Kept (too small to draw)"). Standard arc-second tick labels viaapply_extent, no axis-label text. Vertices are (y,x) → plotted (x,y) (the old debug helper was transposed).animate=Truewritespoint_solver.gif(matplotlibFuncAnimation+PillowWriter, 1.25 s per step, final held 3×, looping). The still and the GIF sharedraw_point_solver_panel, so they cannot drift.PlotterPoint.point_solver, called byVisualizerPoint.visualizeon the full (not quick-update) pass only, i.e. the best fit, behindfit_point_dataset: subplot_point_solver(defaultfalse). It re-solves with NumPy (xp=np), because the JAX path pads steps toMAX_CONTAINING_SIZEand hides them insidejit. It logs a warning when any step keeps ≥ 80 % ofMAX_CONTAINING_SIZE(20) triangles.s=60,lw=1.2), so the observed dot stays visible under an exact fit.Step.tree_flattennow returnsplane_triangles(it returned 5 children for 6 fields, sotree_unflattenraisedTypeError). The unused debug moduleautolens/point/visualise.py(no callers,plt.show()only, transposed axes) is removed.Defaults confirmed by implementing (flagged for the human, not explicitly signed off):
point/visualise.pyis retired outright rather than wrapped.tree_flattenfix is in this PR.API Changes
Adds
aplt.plot_point_solver(2×2 still or GIF) and thefit_point_dataset: subplot_point_solvervisualizer toggle (off by default). Removes the unused debug moduleautolens.point.visualise. FixesStep.tree_flatten. The model marker in the point Fit Positions panel is thinner.See full details below.
Test Plan
pytest test_autolens: 873 passed, 1 xfailed (pre-black). After black:test_autolens/point240 passed, 1 xfailed.test_autolens/point/plot/test_point_solver_plots.py: panel selection 0/1/2/final, (y,x)→(x,y) swap with NaN rows dropped, rejected lens-centre candidate, ▲ fallback on the final step only, legend entries, still written, GIF written with 4 frames + loop=0 + final frame held 3×, the animation returned without a path, the JAX-cap warning.test_plotter_point.py: toggle off by default; on writespoint_solver.png.triangles/test_step.py:tree_flattenround trip.point_solver.pngfor point_source_image_chi_squared and both cluster planes, a coarse teaching PNG + GIF, and re-renderedfit.pngs. The workspace PR follows.Full API Changes (for automation & release notes)
Added
autolens.plot.plot_point_solver(solver, tracer, source_plane_coordinate, positions=None, plane_redshift=None, image_plane_lines=None, output_path=None, output_format=None, title_prefix=None, animate=False, filename="point_solver"): the still, or the GIF withanimate=True. Withoutoutput_paththe still is shown and theFuncAnimationreturned.autolens.point.plot.point_solver_plots:point_solver_data_from,plot_point_solver_from_data,draw_point_solver_panel,legend_handles_from,select_steps,split_kept_from,neighbour_rim_from,triangles_xy_from,warn_if_near_jax_cap,PointSolverFigureData.PlotterPoint.point_solver(fit, image_plane_lines=None).visualize/plots.yaml:fit_point_dataset: subplot_point_solver: false.Removed
autolens.point.visualise(visualise,plot_triangles,plot_triangles_compare): debug-only, no callers in the library or workspaces.Changed Behaviour
VisualizerPoint.visualize(non-quick-update) outputspoint_solver.pngwhensubplot_point_solveris on.Step.tree_flattenincludesplane_triangles, soStep.tree_unflattenround-trips.positions_panel.plot_fit_model_positions: the model ✕ iss=60,linewidths=1.2(was 80 / 2.5).Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code