Skip to content

feat: overlay point-source positions on a dataset image (+ PyAutoEyes figure) #779

Closed

Description

@Jammy2211

Overview

For point-source modeling (e.g. a lensed quasar), passing an image of the dataset should give a figure with the observed (and model) point positions clearly plotted over it. Today AnalysisPoint(image=...) silently drops the image and no point plot can draw a background. This task adds an image_with_points.png figure. It makes the workspace and visualization simulators produce realistic point images (delta-function lp.PointSource + PSF). It then surfaces the figure on the PyAutoEyes board for point_source_image_chi_squared and point_source_source_chi_squared.

Heart RED at start (unrelated PyAutoFit/smoke failures). The human invoked the development override on 2026-10-21.

Plan

  • PyAutoLens: AnalysisPoint stores image. A new image_with_points.png figure draws the image with observed positions (high-contrast markers), model positions (red crosses, post-fit) and optional critical curves. VisualizerPoint emits it before and after the fit (incl. quick_update) when an image is given.
  • autolens_workspace: the point simulator builds the image from lp.PointSource components at each multiple-image position (intensity ∝ flux × |magnification|, image-plane galaxy, PSF-convolved). The modeling/fluxes/extra_galaxies scripts pass image=data, and the misleading docstring is fixed.
  • autolens_visualization: the point simulator writes data.fits/psf.fits with the same recipe. Both producers pass the image, the keep-helper retains image_with_points.png, and the manifest and GALLERY.md are rebuilt.
  • PyAutoEyes: the board is re-rendered after the viz PR merges, so the third PNG appears. No Eyes code change.
  • Order: library → workspace → visualization → Eyes re-render.

Tier: judge — merge mode: human /prm

Detailed implementation plan

Affected Repositories

  • PyAutoLens (primary)
  • autolens_workspace
  • autolens_visualization
  • PyAutoEyes (board re-render only)

Branch Survey

Repository Current Branch Dirty?
lens/PyAutoLens main clean
lens/autolens_workspace main untracked root dataset.fits (not ours, left alone)
lens/autolens_visualization main clean

Suggested branch: feature/point-source-image-overlay

Implementation Steps

  1. autolens/point/model/analysis.py: set self.image = image (currently accepted at :63 but dropped). Document it as visualization-only.
  2. autolens/point/plot/fit_point_plots.py: add plot_image_with_points(image, dataset, fit=None, output_path=None, output_format=None, image_plane_lines=None, image_plane_line_colors=None, title_prefix=None). It calls plot_array(array=image), overlays dataset.positions (white fill, black edge, s≈60) and, when fit is given, fit.positions.model_data (red x). It adds a legend and saves image_with_points.png. Export it via autolens/plot/__init__.
  3. autolens/point/model/plotter.py: add PlotterPoint.image_with_points(...), gated by plots.yaml point_dataset.image_with_points / fit_point_dataset.image_with_points. Add the default config keys (true).
  4. autolens/point/model/visualizer.py: when analysis.image is not None, call it in visualize_before_fit (observed only) and in visualize (with model positions; also on quick_update=True).
  5. Tests in test_autolens/point/: the image is stored, the plot writes its file, and the visualizer emits it only when an image is given.
  6. autolens_workspace scripts/point_source/simulator.py __Imaging__: replace the tiny ExponentialCore arcs with al.lp.PointSource at each solved image position on an image-plane (lens-redshift) galaxy, alongside the lens light. Use a Gaussian PSF via SimulatorImaging, add prose on why the points live in the image plane, and regenerate dataset/point_source/simple/data.fits. Pattern: autogalaxy_workspace/scripts/imaging/features/point_source/simulator.py.
  7. autolens_workspace modeling.py, features/fluxes.py, features/extra_galaxies/modeling.py (and _image/_source splits if present): pass image=data and fix the docstrings. Smoke-run.
  8. autolens_visualization scripts/misc/simulators/point_source.py: also write data.fits + psf.fits with the same recipe. Producers scripts/point_source_{image,source}_chi_squared/visualization.py pass image=. _viz_cli.keep_dataset_and_fit gains an extra_pngs keep-list. Run the producers, then gallery/gallery_build.py, and commit the PNGs + viz_manifest.yaml + GALLERY.md.
  9. PyAutoEyes: after the viz PR merges, re-render the board and run its check.

Key Files

  • autolens/point/model/{analysis,plotter,visualizer}.py
  • autolens/point/plot/fit_point_plots.py, autolens/analysis/plotter.py (image_with_positions precedent)
  • autolens_workspace/scripts/point_source/{simulator,modeling}.py
  • autolens_visualization/scripts/misc/simulators/point_source.py, scripts/_viz_cli.py, gallery/gallery_build.py

Original Prompt

Click to expand starting prompt

For point source modeling in general I also expect that when a user passes an image of the dataset (e.g. of the lensed quasar)
The points are clearly plotted over the top. I want to implement this (I think the workspace has some inputs descriptions for it).
I want our PyAutoEyes dashboard images for point_source_image_chi_squared and point_source_source_chi_squared to include
this image in addition to dataset.png and fit.png. This also means the workspace needs to simulate an image with what
look like actual point components (e.g. delta function point sources of slight with PSF convolution)? Lets scop this
out and do this, getting to the point where the image is in PyautoEyes.

Activity

  1. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR Created: #780 (commit 0975509). Full test_autolens/ suite: 838 passed, 1 xfailed. Heart readiness is YELLOW (workspace validation 1 failed on euclid diagnose_latent.py; manifest drift 1 mismatch; no rehearsal for current source). The human authorized development on 2026-10-21 ("I override, go"); nothing in that list involves point-source code. Next: workspace (simulator with lp.PointSource images; modeling passes image=data), then autolens_visualization.

  2. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Workspace PRs created (judge tier: human /prm, library first):

    Remaining: after #6 merges, re-render the PyAutoEyes board so the figure appears. Follow-up, not in scope: the critical curve draws as 4 disconnected arcs (pre-existing).

  3. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped — 2026-10-21

    All merged by human /prm, library first:

    • PyAutoLens#780: AnalysisPoint keeps image. New aplt.plot_image_with_points / image_with_points.png draws observed positions as hollow rings and, for image-plane fits only, model positions as red crosses, plus critical curves. Emitted before and after the fit, including on quick_update. Pending release.
    • autolens_workspace#591: the point simulator imaging is now made of PSF-convolved lp.PointSource images; six scripts pass image=data; notebooks regenerated.
    • autolens_visualization#6: both point domains render image_with_points.png. Lint was re-run after feat: overlay point-source positions on a dataset image #780 merged (it had been red only because CI builds against PyAutoLens main).
    • PyAutoEyes: board refreshed (dashboard_refresh run 39586301745, commit a60381f). Both figures are now listed under point_source_image_chi_squared and point_source_source_chi_squared.

    Follow-up, not in scope: the critical curve renders as 4 disconnected arcs on the 100×100, 0.05" grid (pre-existing).

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