Skip to content

feat: cluster/multi-source point figures — unified dataset, global fit, fit_per_image, with_points, per-redshift curves - #794

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/cluster-point-figures
Oct 22, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/cluster-point-figures

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Cluster-scale (multi-source) point-source figures, ported from the v4 prototypes the human approved on 2026-10-21 (closes #793). Every positions figure now uses one visual language for one or many sources, each source's critical curves are drawn at its OWN redshift (absorbing the "point fit critical curves ignore source redshift" bug), and every figure is configured in plots.yaml and written during a real search.fit, including the all-sources figures of a factor-graph (cluster) fit.

  • dataset_point.png "Dataset Positions": source 0 a black dot, further sources colour + marker shape (colour by redshift with a colourbar beyond 8 sources); images labelled i / k·i; no curves.
  • fit.png "Fit Positions": red ✕ at the true model positions, true-length residual lines (solid hard / dashed soft pairing), no exaggerated arrows; per-source own-redshift curves, darker and thicker; σ on the per-source legend entries (2-8 sources); smaller ✕ beyond 8; solver extent; −2 ln L = … instead of χ² = … for FitPositionsImagePairAll; legend in the emptiest corner (single source) or outside the panel (several). The source-plane panel moves to fit_per_image.png.
  • fit_per_image.png (new): one row per source, "Residuals / IP / SP (point_k, z = …)"; square equal panels, library ticks/fonts, no legends; ranking with σ values printed right of the dots, no x axis, unlabelled 1σ/3σ lines, a linear range shared across sources (robust max, off-scale ▸ values); per-image colours shared across the three panels. Source-plane fits rank by the fit's own per-image χ. Beyond 8 sources: fit_per_image/<name>.png.
  • image_with_points.png / fit_image_with_points.png: every source in the same symbols (white-edged), k·i labels, no legend; the fit version draws each source's tangential curves at its own redshift.
  • Curves: point_sources.curves_for_planes evaluates the FULL tracer's deflection field once on a 400×400 grid, differentiates it and contours λt = 0 / λr = 0 (one field for every plane when the mass is in one lens plane). The visualizer uses it for every point figure and the tracer figures, replacing the ~2 min/dataset LensCalc path on the 15-galaxy cluster.
  • Darker/thicker critical curves and caustics everywhere, including the source-plane panel and its inset.

API Changes

New modules autolens.point.plot.point_sources (per-source records, styles, per-plane curves, ranking scales) and autolens.point.plot.multi_source_plots (the five figures for any number of sources). subplot_fit, subplot_dataset and plot_image_with_points keep their signatures (new optional curves / solver kwargs) and delegate to the unified figures; fit.png no longer contains the source-plane panel. PlotterPoint gains fit_per_image, dataset_point_combined, fit_point_combined, image_with_points_combined; VisualizerPoint gains visualize_combined / visualize_before_fit_combined. New plots.yaml keys (all default on): point_dataset: subplot_dataset_combined, image_with_points_combined; fit_point_dataset: fit_per_image, subplot_fit_combined, fit_per_image_combined, fit_image_with_points_combined.
See full details below.

Test Plan

  • test_autolens (full): 925 passed, 1 xfailed (incl. 14 new tests in test_autolens/point/plot/test_multi_source_plots.py: per-plane curves vs LensCalc on a 3-plane lens, styles, legends absent / σ labels / −2 ln L, shared vs lone ranking range, per-source files beyond 8, combined visualizer writes, config toggle)
  • Real search.fit (PYAUTO_TEST_MODE=1, library default plots.yaml) on the point_source dataset: dataset_point.png, image_with_points.png, fit.png, fit_per_image.png, fit_image_with_points.png written
  • Real factor-graph search.fit (2-source cluster, AnalysisFactor ×2): per-analysis figures under analyses/analysis_<i>/image/ and the all-sources figures in the top-level image/ (see comment)
  • Renders compared against the approved v4 prototypes (point_source, cluster source/PairAll, synthetic 24-source)
Full API Changes (for automation & release notes)

Added

  • autolens.point.plot.point_sources: SourceRecord, source_record_from_dataset, source_record_from_fit, assign_styles, PlaneCurves, curves_for_planes(tracer, plane_indexes, extent, shape=400), curves_for_records, curves_for_fits, magnifications_at, union_extent_from, ranking_scales_from, RankingScales
  • autolens.point.plot.multi_source_plots: plot_dataset_positions(datasets, solver=None, ...), plot_fit_positions(fits, solver=None, curves=None, ...), subplot_fit_per_image(fits, curves=None, solver=None, ...), plot_image_with_points(image, datasets=None, fits=None, curves=None, ...) and the draw_* panel helpers
  • PlotterPoint.fit_per_image, .dataset_point_combined, .fit_point_combined, .image_with_points_combined
  • VisualizerPoint.visualize_combined, .visualize_before_fit_combined
  • plot_source_plane_panel(..., point_colors=None, legend=True); plot_mass_centres(ax, tracer, size=140, linewidths=2)
  • plots.yaml keys listed above

Changed

  • fit.png: one "Fit Positions" panel (+ "Fit Fluxes" when fluxes); the source-plane panel is in fit_per_image.png
  • Critical-curve / caustic colours 0.2 / #5c5c00, linewidth 1.8 (CRITICAL_CURVE_COLOR_MAP, CAUSTIC_COLOR)
  • image_with_points figures: no legend, numbered images, title "Image With Points (point_0)"

Migration

  • Workspace config/visualize/plots.yaml files should add the new keys (missing keys fall back to on).

Generated by the PyAutoLabs agent workflow.

Heart: YELLOW (pre-existing, human-acknowledged): manifest drift: workspace checkouts — 1 mismatch vs PyAutoMind/repos.yaml; release validation stale: source moved since rehearsal (PyAutoArray).

🤖 Generated with Claude Code

https://claude.ai/code/session_019Y6tDwGThyc8UowuncXw88

Unified Dataset Positions / Fit Positions figures for one or many point
sources, the new fit_per_image.png (residual ranking / IP / SP rows), multi-
source image_with_points / fit_image_with_points, each source's critical
curves at its own redshift from the full tracer (fast deflection-field
contouring), darker/thicker curves and caustics, -2 ln L for the all-pairs
mixture, and combined (factor-graph) visualization with plots.yaml toggles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Y6tDwGThyc8UowuncXw88
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Oct 21, 2026
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Modelling-run verification (PYAUTO_TEST_MODE=1 Nautilus, library default plots.yaml, worktree libraries):

  • point_source (AnalysisPoint, FitPositionsImagePair, image passed): image/{dataset_point, image_with_points, fit, fit_per_image, fit_image_with_points, galaxies}.png
  • 2-source cluster FactorGraphModel (2x AnalysisFactor, FitPositionsSource, image passed): top-level image/{dataset_point, image_with_points, fit, fit_per_image, fit_image_with_points}.png (all sources) + analyses/analysis_{0,1}/image/{dataset_point, image_with_points, fit, fit_per_image, fit_image_with_points, galaxies}.png
    point_solver.png stays off by default. Note: a factor graph never dispatches visualize_before_fit_combined (PyAutoFit FactorGraphModel has no forwarder), so the combined dataset figures are also written from visualize_combined.

…e_with_points

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Y6tDwGThyc8UowuncXw88
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: cluster/multi-source point figures — unified dataset, global fit, fit_per_image, with_points, per-redshift curves

1 participant