Skip to content

fix: point-source and weak-lensing critical-curve grids (clipped / transposed) - #784

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/point-critical-curve-grid
Oct 21, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/point-critical-curve-grid

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Point-source critical curves were rendering as 4 disconnected arcs (fit_image_with_points.png, on PyAutoEyes). Both VisualizerPoint.visualize and PlotterPoint's fallback computed them on Grid2D.from_extent(extent=dataset.extent_from()). That grid has two problems:

  • Too small: it covered only the multiple images' bounding box plus 0.1". Critical curves often extend beyond the images, so the contour was clipped. When the box lies entirely inside the curve, there is no curve at all.
  • Transposed: extent_from() returns [y_min, y_max, x_min, x_max], but from_extent takes (x0, x1, y0, y1).

The new critical_curve_grid_from(dataset) builds a square grid centred on the images, with half-width 2× their half-span (+0.1"), in x-first extent order. On the visualization dataset, the 4 clipped arcs are now one closed loop of radius 1.6".

The same grid is passed to the point visualizer's tracer and galaxy plots, so those now show the full critical curves too.

Weak lensing (added at the human's request): VisualizerWeak had the same transposed extent_from() → from_extent grid. It now uses the same helper with scale=1.0: a square grid covering the source-galaxy field, in (y, x) order. The helper lives in the shared autolens/lens/plot/critical_curves.py.

Closes #783.

API Changes

  • New autolens.lens.plot.critical_curves.critical_curve_grid_from(dataset, shape_native=(100, 100), scale=2.0, buffer=0.1) (any dataset with extent_from).
  • The point visualizer and plotter (scale 2) and the weak visualizer (scale 1) compute critical curves on this grid. PointDataset.extent_from() is unchanged.
    See full details below.

Test Plan

  • pytest test_autolens/: 846 passed, 1 xfailed.
  • New weak test: a field elongated in y and offset from the origin gets a grid centred on it in (y, x) that covers it. Control: the old grid was transposed.
  • New test: with images inside a 1" box and an Einstein radius of 1.6", the grid yields one closed tangential line of radius 1.6. Control: the old grid returned no curve for this case.
  • New test: the grid is centred on the images in (y, x) and is square, which catches any axis swap.
  • Re-rendered both point domains in autolens_visualization: closed loop through the images.

Readiness

Heart readiness was YELLOW (score 85) at ship time:

  • manifest drift: workspace checkouts (manifest ↔ disk) — 1 mismatch(es) vs PyAutoMind/repos.yaml
  • release validation stale: source moved since rehearsal (PyAutoArray)

The human explicitly acknowledged this on 2026-10-21. Neither reason involves this change.

Full API Changes (for automation & release notes)

Added

  • autolens.lens.plot.critical_curves.critical_curve_grid_from(dataset, shape_native=(100, 100), scale=2.0, buffer=0.1) -> Grid2D

Changed

  • VisualizerPoint.visualize / PlotterPoint.fit_point critical-curve grid: was the images' bounding box with a transposed extent; it is now critical_curve_grid_from(dataset).
  • VisualizerWeak.visualize tracer/galaxies grid: was a transposed extent_from() box; it is now critical_curve_grid_from(dataset, scale=1.0).

Migration

  • None.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

#783)

The grid was the multiple images' bounding box (+0.1"), with its y/x extent
passed in x-first order, so critical curves extending beyond the images were
clipped into disconnected arcs (or lost entirely). critical_curve_grid_from
builds a square grid centred on the images, 2x their half-span.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Visualization PR: PyAutoLabs/autolens_visualization#10

…elper (#783)

critical_curve_grid_from moves to autolens/lens/plot/critical_curves.py and is
also used by VisualizerWeak (scale=1.0: the source galaxies span the field),
whose extent_from() -> from_extent grid was transposed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 changed the title fix: point-source critical curves clipped into arcs by a too-small grid fix: point-source and weak-lensing critical-curve grids (clipped / transposed) Oct 21, 2026
@Jammy2211
Jammy2211 merged commit 0729454 into main Oct 21, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/point-critical-curve-grid branch October 21, 2026 12:18
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 23, 2026
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.

fix: point-source critical curves clipped into arcs by a too-small grid

1 participant