Skip to content

docs: flagship 'PyAutoLens for Lenstool users' example — SMACS J0723 vs the RELICS Lenstool model #239

Description

@Jammy2211

Overview

The flagship adoption example: take the first JWST cluster, SMACS J0723.3−7327, and do a full Lenstool-style analysis in PyAutoLens — same dPIE profiles (via the merged from_lenstool / dPIEMassLenstool API, PyAutoGalaxy#487), same reference-anchored member scaling relation (autolens_workspace#238), same positional constraints — then compare directly against the published RELICS Lenstool model products on MAST. Written for a reader whose mental model is a Lenstool .par file. A real prospective user is available for beta iteration once a draft exists.

Autonomy: supervised --auto, in-session authorization (user directive 2026-07-09: "merge PRs and then do 8_lenstool_user_example").

Reference model (research complete, from Sharon et al. RELICS paper + MAST probe)

  • RELICS Lenstool HST model (arXiv:2208.08483; MAST doi:10.17909/T9SP45): 1 cluster-scale PIEMD (7 free params, r_cut fixed 1000 kpc) + BCG PIEMD (pos/e/θ fixed from F814W SExtractor; r_core/r_cut/σ free) + 143 red-sequence members on the Limousin+05 scaling relation (mag0 = 19.12, r_core* = 0.15 kpc fixed, σ*/r_cut* free). 8 systems / 25 images (Table 1 extracted — positions in hand), photo-z (system 1 fixed z=2.2, others free U(0.5,5)). Image-plane RMS 0.58″. z_lens = 0.388, Ω_m=0.3/Ω_Λ=0.7/h=0.7 (the Lenstool-typical cosmology — exactly the documented from_lenstool cosmology knob).
  • Public products confirmed on MAST (archive.stsci.edu/hlsps/relics/smacs0723m73/): best-fit κ/γ/ψ/deflection maps + μ(z=1,2,4,9) + 100 MCMC map samples (models/lenstool/, range/); ACS+WFC3IR photometric catalogues with BPZ photo-z (catalogs/); 30/60mas drizzled images (images/). No .par/params file published → the comparison target is the maps + image-plane RMS, which is the honest "same analysis, compare outputs" framing anyway.
  • Mahler et al. 2023 (arXiv:2207.07101, Lenstool + MUSE) provides spectroscopic redshifts for several systems — to be extracted in Phase 1 and used where available (documented against the RELICS photo-z choices).

Plan (phased per the Brain routing)

Phase 1 — data prep (scripts/cluster/lenstool/data.py or equivalent): download the F606W/F814W 60mas cutout, the RELICS photometric catalogue, and the Lenstool κ + deflection maps from MAST (runtime download with cached local copies; nothing heavy committed). Build point_datasets.csv from the paper's Table 1 (25 images, 8 systems; spec-z where Mahler+23 provides, else RELICS photo-z treatment) and scaling_galaxies.csv from red-sequence member selection on the catalogue (F606W−F814W CMD, magnitudes → relative luminosities vs mag0=19.12).

Phase 2 — the example (scripts/cluster/lenstool/modeling.py + README): compose the RELICS-equivalent model — cluster-scale dPIEMassLenstool (fitting directly in σ/r_core/r_cut, priors in Lenstool units), BCG dPIEMassLenstool with fixed geometry, member tier on the reference-anchored relation with r_cut scaling — fit with source-plane χ² (Lenstool's default), Lenstool-typical cosmology. Prose maps every concept to its .par equivalent (potentiel section ↔ model component; v_disp/ellipticite/angle_pos ↔ constructor args incl. the √(3/2) σ trap; image catalogue ↔ point_datasets.csv; source-plane vs image-plane χ²). Tutorial prose = judgment tier.

Phase 3 — comparison + wrap (scripts/cluster/lenstool/comparison.py): our max-likelihood tracer's convergence + deflection fields vs the MAST Lenstool maps (pixel-level, with the 100-sample range as the tolerance band); image-plane RMS vs the published 0.58″; per-plane critical curves via the merged cluster plotters (PyAutoLens#578). Honest section on convention differences and where parity is/isn't expected (LTM-free, photo-z freedom, member-selection differences). Then beta-user iteration.

Affected Repositories

  • autolens_workspace (primary; worktree ~/Code/PyAutoLabs-wt/lenstool-example/, branch feature/lenstool-example)

Original Prompt

Click to expand starting prompt

$(cat PyAutoMind/docs/cluster/8_lenstool_users_example.md)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions