Skip to content

feat: point positions panels — solver extent, visible markers, noise circles, titles #785

Closed

Description

@Jammy2211

Overview

The point-source "Positions" panels (dataset.png, and the "Fit Positions" panel of fit.png) are still the bare grid scatter: tiny dots, points clipped at the panel edge (axes ±1.5″, images out to ~±2.2″), axis labels overlapping tick labels, and no noise shown. This task redraws both panels around the PointSolver grid extent with large markers, an honest σ noise circle, clear titles, critical curves and mass-profile centres. Cluster shares these functions and changes too.

Plan

  • Panel extent = the PointSolver grid extent when a solver is available (dataset panel via the visualizer/plotter, fit panel via fit.solver); without one, fall back to the fix: point-source critical curves clipped into arcs by a too-small grid #783 critical-curve region so nothing is clipped.
  • Remove the x (") / y (") axis labels.
  • Large filled markers for observed positions; model positions drawn on top.
  • A circle at each position's noise-map radius (never inflated) and σ always in the legend, e.g. Observed (σ = 0.005″).
  • Titles Dataset Positions (point_0) / Fit Positions (point_0).
  • Fit panel: critical curves (still computed on critical_curve_grid_from); a curve running past the solver-extent edge is clipped cleanly at the frame. Mass-profile centres of every galaxy in the tracer marked with a distinct marker and a Mass centre legend entry (decision 7).
  • Residual lines (decision 9): a thin line from each observed position to the model position the fit's own pairing matches it to (Hungarian for FitPositionsImagePair, nearest for PairRepeat, dominant/nearest term for PairAll); skipped for source-plane chi-squared fits (no image-plane pairing). Legend Residual.
  • Unmatched model images (decision 10): model positions no observed position pairs to, drawn as hollow grey crosses, legend Unmatched model image. Out of scope: per-position chi-squared numbers.
  • Keep the public API backward compatible (solver optional). Unit tests for extent, fallback, titles, σ legend and mass centres.
  • Then re-render autolens_visualization (point_source_image_chi_squared, point_source_source_chi_squared, cluster) in a follow-up workspace PR.
Detailed implementation plan

Work Classification

Both (library first: PyAutoLens; then workspace: autolens_visualization)

Affected Repositories

  • PyAutoLens (primary)
  • autolens_visualization

Branch Survey

Repository Current Branch Dirty?
./lens/PyAutoLens main clean
./lens/autolens_visualization main clean

Suggested branch: feature/point-dataset-positions-panel
Worktree root: ~/Code/PyAutoLabs-wt/point-dataset-positions-panel/

Implementation Steps

  1. Add a shared positions-panel helper (extent from solver / fallback, large markers, σ circles + legend, critical-curve overlay, mass centres, no axis labels) used by autolens/point/plot/point_dataset_plots.py and autolens/point/plot/fit_point_plots.py.
  2. subplot_dataset(..., solver=None); subplot_fit(..., solver=None) defaulting to fit.solver; draw image_plane_lines on the fit panel.
  3. Thread the solver: PlotterPoint.dataset_point(dataset, solver=None), VisualizerPoint.visualize_before_fit passes analysis.solver.
  4. Tests in test_autolens/point/plot/ and test_autolens/point/model/.
  5. autolens_visualization: cluster producer passes solver= to dataset_point; re-render the three domains; commit PNGs + GALLERY.md + gallery/viz_manifest.yaml.

Key Files

  • autolens/point/plot/point_dataset_plots.py — dataset positions panel
  • autolens/point/plot/fit_point_plots.py — fit positions panel
  • autolens/point/model/plotter.py, autolens/point/model/visualizer.py — solver threading
  • autolens_visualization/scripts/cluster/visualization.py — passes the solver

Original Prompt

Click to expand starting prompt (incl. decisions 7-10 added 2026-10-21)

Point-source positions panels: extent, markers, noise and titles

Consequence: judge
Autonomy: human-required
Issued: 2026-10-21
Issue: #785

@PyAutoLens @autolens_visualization

Origin (2026-10-21, Eyes review of the point_source_* figures in scratch)

point_source_*/visualization/dataset.png is the old bare positions plot:

  • the positions are tiny dots
  • points are clipped at the top and right edges (axes ±1.5″, images out to ~±2.2″)
  • the x (") / y (") axis labels overlap the tick labels
  • no noise is shown

The human said "I thought we fixed this but maybe not" and agreed to every point below.

Approved decisions (human, in chat)

  1. Extent. The positions panel extent is the PointSolver grid's extent when a solver is available. This ties the figure to where the model can find images; zooming out is acceptable and wanted. With no solver, fall back to the fix: point-source critical curves clipped into arcs by a too-small grid #783 critical-curve region (critical_curve_grid_from) or the data bounding box plus a margin, so nothing is clipped.

  2. Axis labels. Remove the x (") / y (") labels.

  3. Markers. Use large filled markers for positions.

  4. Noise. Draw a circle at the true positions noise-map radius (one isotropic σ per position, so a circle, not error-bar crosses), and always put σ in the legend, e.g. Observed (σ = 0.005″). At HST noise (0.005″) and the solver extent (~±5″) the circle is sub-pixel. That is honest; never inflate it.

  5. Titles. Dataset Positions (point_0); the fit panel is Fit Positions (point_0).

  6. Fit panel. Apply the same treatment to the "Fit Positions" panel of fit.png, with model positions drawn on top. Cluster domains share these functions and change too.

  7. Mass centres (scope addition, human, 2026-10-21). The "Fit Positions" panel of fit.png also marks the centre of every mass profile in the fit's tracer (the image-plane lens galaxies; for cluster/group, all of them) with a distinct marker and a Mass centre legend entry, with a test that the centres are plotted.

  8. Critical curves on the Fit Positions panel (scope addition, human, 2026-10-21) — not only on fit_image_with_points.png, because a user may not supply an image. Computed with critical_curve_grid_from (fix: point-source critical curves clipped into arcs by a too-small grid #783); the same deliberate-clipping rule at the solver-extent panel edge applies. Thin and light, so they do not swamp the residual lines.

  9. Residual lines (scope addition, human, 2026-10-21). A thin line from each observed position to its paired/matched model position, using the pairing the fit's chi-squared actually uses (FitPositionsImagePair / PairRepeat / PairAll each by its own matching). Source-plane chi-squared fits have no image-plane pairing: skip the lines and say so in the docstring. Legend entry Residual.

  10. Unmatched model images (scope addition, human, 2026-10-21). Model positions with no observed counterpart (see n_unmatched_model_positions in autolens/point/fit/positions/image/pair_repeat.py) drawn in a distinct style (e.g. hollow grey crosses), legend Unmatched model image.

Explicitly out of scope: per-position chi-squared numbers. Tests cover 8-10, and they are judged visually in the scratch renders (point_source_image_chi_squared shows lines; source_chi_squared must still look right without them; cluster must stay readable).

Critical curves (#783). Keep computing them on critical_curve_grid_from. If a curve runs past the solver-extent panel edge, that clipping is informative (the curve extends beyond the solver grid), but it must look deliberate and not like broken arcs.

Shape

Library first: PyAutoLens autolens/point/plot/point_dataset_plots.py + fit_point_plots.py (+ the plotter/visualizer that knows the solver). Then an autolens_visualization re-render PR (point_source_image_chi_squared, point_source_source_chi_squared, cluster). While iterating, mirror to PYAUTO_EYES_SCRATCH (eyes/autolens/<domain>/) so the human can comment before CI.

Activity

  1. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR Created

    PyAutoLens: #786 (pending-release). Full test_autolens: 859 passed, 1 xfailed.

    Workspace follow-up: autolens_visualization re-render (point_source_image_chi_squared, point_source_source_chi_squared, cluster) on the same branch, plus the cluster producer passing solver= to dataset_point and computing the fit panel's critical curves.

  2. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped. Merged via /prm on 2026-10-21, library first. Every CI leg was green: #786 unit tests (3.12, 3.13, nojax) and docs. #11 lint passed on its re-run after #786 merged; the first run failed only on the new solver= argument, against the old library main.

    • PyAutoLens#786 (d7a14b0), pending release
    • autolens_visualization#11 (39a8547d)

    Follow-ups filed in Mind:

    • PointSolver refinement figure (phase 2)
    • workspace placement (phase 3)
    • source-plane fit panel
    • multi-plane critical curves ignoring the source redshift (bug)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions