Skip to content

Restructure the lecture series: point sources + formalism lectures, chaining into chapter 2, pixelizations as chapter 3, new Scaling Up Lensing chapter 4 - #68

Merged
Jammy2211 merged 22 commits into
mainfrom
claude/howtolens-tutorial-restructure-f19y9d
Aug 6, 2026
Merged

Restructure the lecture series: point sources + formalism lectures, chaining into chapter 2, pixelizations as chapter 3, new Scaling Up Lensing chapter 4#68
Jammy2211 merged 22 commits into
mainfrom
claude/howtolens-tutorial-restructure-f19y9d

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Major restructure of the HowToLens lecture series:

Chapter 1 — Introduction

  • tutorial_4_point_sources written in full (was a stub): what point sources are, the lens equation as an inverse problem, the triangle-based PointSolver, multiple images and critical curves, magnifications and why fluxes are unreliable, time delays.
  • tutorial_5_lensing_formalism written in full (was a stub): the series' single equations lecture — distances, the lens equation, convergence/Σ_cr, deflections, the potential, shear and the Jacobian, critical curves/caustics, Einstein radius, time delays — all lensing math from other tutorials is deferred here.
  • tutorial_6_data gains one-block interferometer and weak-lensing sections (each backed by a new simulator), stating interferometry is not covered further and deferring weak lensing to chapter 4 as foreshadowing.

Chapter 2 — Lens Modeling

  • tutorial_8_need_for_speed rewritten for the JAX era (JIT compilation, use_jax=True default, GPU, run-time drivers), replacing the outdated numba-centric story.
  • Old chapter 3's tutorials 1, 2 and 6 move in as tutorials 9 (search chaining), 10 (prior passing) and 11 (SLaM), reframed as the chapter's closing arc; old chapter 3 tutorials 3/4/5 are deleted.

Chapter 3 — Pixelizations (was chapter 4)

  • Renumbered (borders 5→6 … adaptive_regularization 11→12) to make room for a new tutorial_5_bayesian_formalism: the pixelization equations lecture mirroring the workspace's pixelization/likelihood_function.py (mapping/blurred mapping matrices, data vector D, curvature F, regularization H, the solve, all five evidence terms, WD03/N15/Suyu citations), computed live.
  • Prose cleanup throughout; the borders tutorial's cap-induced CI failure is fixed (dead sub-border assignments removed, wrong dataset pixel scale corrected) and its no_run.yaml skip dropped.

Chapter 4 — Scaling Up Lensing (new)
Six new tutorials: extra galaxies (noise scaling vs explicit modeling), multi-galaxy lenses (x2 modeled with MGE + fixed centres, mass degeneracies, x3 close), scaling relations (luminosity-tied masses, runtime-verified parameter accounting, limitations), group scale (LCDM framing, dPIE truncation, scaling members, the "sweet spot"), cluster scale (multi-plane, point-source rationale, CSV interface, results deep-dive) and weak lensing (shear catalogues, simulate → fit → model, closes the series). Six new simulators support them.

All content was adversarially reviewed (equations, parameter counts and API claims verified against the installed stack by re-execution); READMEs, introductions, the navigator catalogue (llms.txt / llms-full.txt / workspace_index.json), notebooks and the chapter 1 executed-markdown renders are regenerated.

Validation

  • Full smoke suite: 39/39 scripts PASS from a clean dataset state (all auto-simulate guards exercised).
  • check_tutorials_complete.py and check_navigator.py: pass.
  • Notebooks regenerated via PyAutoHands generate.py; markdown renders 9/9 PASS.

Merge coordination

CI runs the PyAuto* libraries from same-named branches, so this PR validates against its companions. Suggested merge order: PyAutoGalaxy (mge_model_from centre_fixed fix) and PyAutoHands (setup_notebook uncomment fix) first, then this PR, then the autolens_workspace / PyAutoLens cross-reference PRs. Colab links for new/renamed notebooks are pinned to tag 2026.8.4.1 per convention and resolve after the next release's bump_colab_urls.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU


Generated by Claude Code

claude added 21 commits August 6, 2026 12:28
…, pixelizations become chapter 3

Chapter 3 (search chaining) is dissolved: tutorials 1, 2 and 6 move to the
end of chapter 2 as tutorials 9 (search chaining), 10 (prior passing) and
11 (SLaM); tutorials 3, 4 and 5 are deleted. Chapter 4 (pixelizations) is
renamed chapter 3, with tutorials 5-11 renumbered to 6-12 to make room for
a new tutorial 5 (bayesian_formalism, added next). An empty
chapter_4_scaling_up_lensing is scaffolded for the new scaling-up chapter.

File moves only (plus the no_run.yaml borders rename); content updates to
titles, cross-references and prose land in follow-up commits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Replaces the outdated numba-centric run-time story with the current
reality: JIT compilation of the whole likelihood via JAX (on by default
through use_jax=True), CPU vs GPU batching, compilation overhead, and
run-time estimation. Chaining is reframed as this chapter's closing
tutorials 9-11 and stale HowToGalaxy/chapter references are fixed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Replaces the stub with a full lecture: what point sources are, the lens
equation as an inverse problem, the triangle-based PointSolver, multiple
images and critical curves, magnifications and why fluxes are unreliable,
time delays, and how point-source computations differ from the
extended-source forward model. Verified against the installed stack and
runs end-to-end in both smoke and full-resolution modes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
…torial

tutorial_6_data gains two short sections: one loading and plotting an
interferometer dataset (visibilities, uv-plane fitting) that states
HowToLens will not cover interferometry further, and one loading and
plotting a weak-lensing shear catalogue that defers all detail to
chapter 4 as deliberate foreshadowing. Both are backed by new
scripts/simulator/ scripts adapted from the workspace simulators, wired
in with the standard auto-simulate guard.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Closes the scaling-up chapter and the core series: what weak lensing is,
shear catalogues and their upstream production, the mass-scale ladder
from single galaxies to clusters, in-memory simulation of shear data,
whisker plots and Kaiser-Squires mass maps, fitting with FitWeak,
modeling with AnalysisWeak, tangential shear profiles with a B-mode null
test, and joint strong+weak framing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Replaces the stub with the series' equations lecture: cosmological
distances, the lens equation, convergence and critical surface density,
deflection angles, the lensing potential, shear and magnification via
the Jacobian, critical curves and caustics, the Einstein radius as the
robust mass measurement, and time delays. All lensing mathematics from
the rest of the series is deferred here, with every quantity computed
and plotted through the live API.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
…orials 9-11

The moved tutorials are retitled and reframed as the closing arc of the
lens-modeling chapter, motivated by tutorial 8's run-time discussion.
Output paths and search names move to chapter_2; references to the
deleted chaining tutorials reroute to the workspace's current chaining
and SLaM guides; stale chapter cross-references in tutorials 3-5 now
match the new chapter numbering.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
The co-dominant deflector regime: mergers vs line-of-sight alignments,
modeling the x2 system with MGE light + isothermal masses, runtime-
verified parameter accounting, the fixed-mass-centre trick and the
inter-galaxy mass degeneracy, foreshadowing of the shared-halo framing
at group scale, and a closing three-lens example backed by a new
lens_x3 simulator.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Opens the scaling-up chapter with the full ladder framing, then teaches
the two ways to handle a nearby interloper galaxy: noise scaling its
light out of the fit, or modeling it explicitly through the
extra_galaxies model interface with centres fixed to the observed light.
Central framing is whether the neighbour's light and/or mass affects the
main lens analysis. Backed by a new lens_extra_galaxy simulator that
also outputs the extra-galaxies mask and centres.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Replaces per-galaxy mass freedom with a few global relation parameters:
Faber-Jackson motivation, luminosity-tied Einstein radii over the x2
dataset, runtime-verified parameter accounting including a composed
12-member model whose dimensionality does not grow, an honest
limitations section (scatter, deviant members, anchor anomalies), and
the environment-of-single-lenses use case.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Defines the group scale in LCDM terms (10^13-10^14 Msun halo, BGG, the
blurry multi-galaxy/group boundary), introduces tidal truncation and the
dPIE mass profile parameter-by-parameter, shows a fit.py-style fit and
the effect of adding a group-scale halo, then models members
individually and through a scaling relation. Frames group scale as the
sweet spot where galaxy-scale tools (including pixelized sources) still
work at low dimensionality. Backed by a new group simulator whose
members exactly obey the scaling relation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
…formalism lecture

New tutorial_5_bayesian_formalism collects the pixelized-source linear
algebra in one place (mapping and blurred mapping matrices, data vector,
curvature and regularization matrices, the regularized solve and all
five log-evidence terms, computed live against the chapter's dataset).
The other twelve tutorials get their new numbers, chapter references
matching the restructure, light algebraic framing that defers
derivations to tutorial 5, and prose cleanup. tutorial_6_borders'
cap-induced failure is fixed (dead sub-border assignments removed) and
its NEEDS_FIX skip is dropped from no_run.yaml.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Defines the cluster regime (30+ member galaxies, >1e14 Msun, many
sources at different redshifts), explains multi-plane ray tracing at
HowTo level, motivates the move to point-source position fitting, and
teaches the CSV interface for composing member catalogues into a
factor-graph model. A dedicated results section walks through accessing
the multi-plane tracer, per-member profiles, source-plane positions,
magnifications and errors. Backed by a new cluster simulator producing
the imaging, CSV catalogues and point datasets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
… structure

Chapter README indexes gain tutorials 9-11 (chapter 2), the renumbered
pixelizations listing with the new Bayesian formalism tutorial (chapter
3) and a new chapter 4 index; the top-level scripts/notebooks READMEs
drop the stale five-chapter/hyper-mode overview in favour of the real
four-chapter map; chapter 2's legacy summary file moves past the new
tutorials and mentions chaining; chapter 4 gains an introduction file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
…orrections

Adversarial review of the pixelizations chapter: the borders tutorial
now loads x2_lens_galaxies at the simulator's real 0.1" pixel scale,
actually uses its large-mask demo and matches the simulator's true mass
profiles; a stray stale-fit plot is removed from lens modeling; the
Bayesian formalism lecture gets the correct second-derivative in the
WD03 regularization definition, consistent indices and a Contents entry
for its Fit section; adaptive-pixelization pixel counts match the real
28x28 mesh; fit-problems prose stops claiming an Overlay image-mesh;
Voronoi->Delaunay in the chapter README and introduction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Adversarial review of the parallel-written scaling-up chapter: the
tied-member population now consistently uses the scaling_galaxies
collection at group scale (matching tutorials 3 and 5, verified against
the library's tracer composition); scaling exponents tie back to the
Faber-Jackson derivation; source-profile claims match the simulators
(ExponentialCoreSph, fixed in lens_x2/lens_x3 headers too); the weak
lensing simulator's shear amplitudes now agree with its tutorial's SIS
arithmetic; hand-off and teaser sentences across tutorials 1-6 align
with what each tutorial actually covers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
…laims

Adversarial review: pre-restructure titles and cross-references fixed
(more_ray_tracing was still 'Tutorial 5', the summary 'Tutorial 9');
caustic image-multiplicity statements corrected to the changes-by-two
rule with the three-region statement; the fitting tutorial's noise
normalization prose now matches its sum-of-logs formula; parameter
counts, n_live values and prior/profile names align with the code and
simulators (verified by introspection); need-for-speed quotes the real
JAX jit log message; HowToGalaxy copy-paste and workspace-path confusion
fixed; Contents lists now match every file's actual sections; scores of
typos cleaned across both chapters and the optional searches tutorial.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Notebooks rebuilt from the restructured scripts via PyAutoHands
generate.py (new chapter 3/4 trees, updated chapters 1-2, simulator
notebooks); llms-full.txt and workspace_index.json regenerated; the
curated llms.txt learning path updated to the new chapter map.
check_navigator passes (paths + banner lint).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
With the PyAutoHands uncomment fix, generated notebooks now activate
'from autolens import setup_notebook; setup_notebook()' so they run
from the workspace root (Colab and local Jupyter alike).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
All nine curated chapter 1 pages rebuilt with their real output images,
including the newly written point-sources and lensing-formalism
tutorials and the extended data tutorial (interferometer + weak lensing
sections). Rendering the dataset-loading tutorials was unblocked by the
PyAutoHands setup_notebook uncomment fix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
CI's Python 3.13 leg deliberately runs the lean no-optional-deps path
without jax; the new cluster simulator imports jax for its jitted
multi-plane PointSolver, failing that leg (and the cluster tutorial with
it via the auto-simulate subprocess). Both now use the established
importlib find_spec / sys.exit(0) guard — the same idiom as the two
jax-only chapter 3 tutorials — exiting cleanly with an explanatory
message when jax is missing, verified both with jax removed (clean skip)
and present (full run). Notebooks regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
@Jammy2211
Jammy2211 merged commit 9be4348 into main Aug 6, 2026
12 of 16 checks passed
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.

2 participants