Skip to content

feat: cluster plots honor the configured critical-curve engine - #808

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/cluster-curves-engine-dispatch
Oct 28, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/cluster-curves-engine-dispatch

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Closes #807 (cluster-strong-lensing epic, phase-3a subtask). plot_critical_curves and plot_caustics in autolens/cluster/plot/cluster_plots.py always called the marching-squares LensCalc routines and ignored general.critical_curves_method.

They now read that setting once per call through PyAutoGalaxy's shared selector, autogalaxy.util.plot_utils._critical_curves_method(). That selector already applies the unknown-value fallback and the missing-jax_zero_contour fallback, so cluster plots behave exactly like every other plot. Each source plane's tangential and radial critical curves and caustics are routed as follows:

  • marching_squares (the default) calls *_list_from(grid=grid), exactly as before.
  • zero_contour calls *_list_via_zero_contour_from() with its defaults, as ag.util.plot_utils._critical_curves_from and _caustics_from do.

The multi-plane LensCalc per plane (use_multi_plane=True, plane_j=j), the colours, labels, radial option and source-plane mapping are all unchanged.

Known limit, documented in the docstrings. With zero_contour, seeds come from LensCalc's automatic ±3" coarse scan, so cluster-scale curves outside that box are not drawn. This matches the other plots' behaviour. Cluster-scale accuracy and context-aware dispatch belong to the remaining phase-3 scope.

API Changes

None. This is internal routing only: there are new private helpers _CURVE_ROUTINES, _critical_curves_method and _curve_list_from.
See full details below.

Test Plan

  • test_autolens/cluster/plot/test_cluster_plots.py: 12 passed, 6 of them new. They use a two-source-plane PowerLaw fixture with tangential and radial curves in both planes.
    • Per-plane routing with spies, for both engines, for critical curves (selector monkeypatched) and for caustics (engine set through the config). The tests check call order, arguments and the single selector read per call.
    • The z=1 and z=2 plane geometries are distinct.
    • The default radial option is respected.
    • A configured zero_contour with jax_zero_contour unavailable falls back to marching squares and logs a warning.
    • These test routing only; they make no JIT or gradient claims.
  • Full suite python -m pytest test_autolens -n 8: 979 passed, 1 skipped, 1 xfailed.
  • Workspace cluster visualisation smoke: not run. autolens_workspace is not in this session.
  • CI matrix (3.12, 3.13) green.
Full API Changes (for automation & release notes)

Added

  • None public. Private: _CURVE_ROUTINES, _critical_curves_method(), _curve_list_from(lens_calc, grid, method, kind, curve_type) in autolens/cluster/plot/cluster_plots.py.

Removed

  • None.

Migration

  • None required. Behaviour changes only when general.critical_curves_method: zero_contour is configured.

Generated by the PyAutoLabs agent workflow.


Generated by Claude Code

plot_critical_curves and plot_caustics in autolens/cluster/plot/cluster_plots.py
always called the marching-squares LensCalc routines. They now read
general.critical_curves_method once per call through PyAutoGalaxy's
autogalaxy.util.plot_utils._critical_curves_method() (same unknown-value and
missing-jax_zero_contour fallbacks as every other plot) and route each source
plane's tangential/radial critical curves and caustics to the marching-squares
(*_list_from(grid=grid), default, unchanged) or zero-contour
(*_list_via_zero_contour_from()) routines. Multi-plane LensCalc per plane,
colours, labels, radial option and source-plane mapping preserved.

Known limit, documented: zero_contour seeds from LensCalc's +/-3" coarse scan,
so cluster-scale curves outside that box are not drawn (remaining phase-3 scope).
No public API change. Issue #807.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016nhQ8NtZ6QtuqxKKAnhhdg
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Oct 28, 2026 — with Claude
@Jammy2211
Jammy2211 merged commit 1faa99a into main Oct 28, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/cluster-curves-engine-dispatch branch October 28, 2026 17:17
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Oct 29, 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.

feat: cluster plots honor the configured critical-curve engine

2 participants