From 443a1ec0a71fc2ccbc3f9ea74f6091f69d4ce5f6 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 14 Sep 2026 20:51:33 +0100 Subject: [PATCH 1/3] Model figures: collapse per-figure prose to the canonical two paragraphs The per-figure reading commentary rolled out in phase 6 is information overload: the figure should be self-explanatory. Every first-figure prose block now collapses to the same two paragraphs, which say what the figure shows and point at `model.info` for the numbers. All 12 tutorials with a figure site are swept. Where a trailing paragraph taught the tutorial's own science or method rather than describing the figure, that sentence is preserved as a third paragraph, reworded so it stands on its own without referring to pills, cards, badges or plates. Two tutorials (chapter 2 tutorial 5, chapter 4 tutorial 4) had nothing of that kind and collapse entirely. Short notes at second and later figure sites are untouched. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01LPCvGNHahZqynPyEfMijsb --- .../tutorial_10_prior_passing.py | 15 +++++---- .../tutorial_1_non_linear_search.py | 32 ++++++------------- .../tutorial_2_practicalities.py | 18 +++++------ .../tutorial_4_dealing_with_failure.py | 23 ++++++------- .../tutorial_5_linear_profiles.py | 16 ++++------ .../tutorial_9_search_chaining.py | 12 +++---- .../tutorial_1_extra_galaxies.py | 26 ++++++--------- .../tutorial_2_multi_galaxy.py | 24 ++++++-------- .../tutorial_3_scaling_relation.py | 26 ++++++--------- .../tutorial_4_group_scale.py | 20 ++++-------- .../tutorial_5_cluster_scale.py | 29 ++++++----------- .../tutorial_6_weak_lensing.py | 22 ++++++------- 12 files changed, 102 insertions(+), 161 deletions(-) diff --git a/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py b/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py index a33ae13..3189a64 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py +++ b/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py @@ -115,13 +115,16 @@ print(model_1.info) """ -This is the same model as the first search of the previous tutorial, so it is the same map: greyed `centre` and -`sersic_index` pills for the parameters fixed to values, the blue `shared ×2` and `↗ bulge.ell_comps` pair -joining the mass's ellipticity to the bulge's, dashed `intensity · solved` pills on both linear light profiles, -and a footer of `11 unique sampled scalars`. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. -Hold this map in mind as you read the second model below. This tutorial is about what changes between the two — -and, more importantly, about what does not. +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +This is the same model as the first search of the previous tutorial. Keep it in mind as you read the second +model below: this tutorial is about what prior passing changes between the two and, more importantly, about what +it does not. """ af.ModelPlotter(model_1).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py b/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py index ecead8a..866d884 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py +++ b/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py @@ -294,29 +294,15 @@ print(model.info) """ -The same model can also be drawn as a figure, via `af.ModelPlotter`. - -The figure and the `info` are two views of the same model, and it is worth being precise about the division of -labour between them. The figure is the **map**: it shows the structure of the model, meaning which galaxy owns -which profile, which profile owns which parameter, and what state every parameter is in — free, fixed to a -value, shared with another parameter, related to one by an expression, or solved for during the fit rather than -sampled. The `info` printed above is the **legend**: it lists the priors and values themselves, the numbers the -map has no room for. - -Read this first map from the outside in. The outer frame is titled `galaxies`, after the `Collection` we just -composed. Inside it sit two cards, `lens · Galaxy` and `source · Galaxy`, each labelled underneath with its -redshift, `redshift = 0.5` and `redshift = 1.0` — which is how **PyAutoLens** knows which galaxy does the -lensing and which one is lensed. Inside the lens card is a single profile card, `mass · IsothermalSph`, holding -the pills `centre` (carrying a `2D` badge, because a centre is a tuple of two coordinates) and `einstein_radius`. -Inside the source card is `bulge · ExponentialCoreSph`, whose greyed-out `radius_break`, `gamma` and `alpha` -pills mark parameters fixed to default values, and whose dashed `intensity · solved` pill marks the one -parameter that is not sampled at all: because this is a linear light profile, its `intensity` is solved for by -linear algebra at every likelihood evaluation. The footer totals the model up as `6 unique sampled scalars`, -`5 fixed leaf slots` and `1 parameter solved during fitting`. - -Draw the map every time you compose a model. It fits on one screen now and may look like a redundant restatement -of the `info`, but the two views scale very differently: by chapter 4 our models hold fifteen galaxies and their -`info` runs to hundreds of lines, whilst the map still fits in a glance. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +Each galaxy is labelled with its redshift, `redshift = 0.5` for the lens and `redshift = 1.0` for the source. +That is how **PyAutoLens** knows which galaxy does the lensing and which one is lensed. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_2_practicalities.py b/scripts/chapter_2_lens_modeling/tutorial_2_practicalities.py index 14af3e0..44802a8 100755 --- a/scripts/chapter_2_lens_modeling/tutorial_2_practicalities.py +++ b/scripts/chapter_2_lens_modeling/tutorial_2_practicalities.py @@ -175,16 +175,14 @@ print(model.info) """ -As in the previous tutorial we also draw the model, remembering the division of labour between the two views: -the figure is the **map**, showing the structure of the model — which galaxy owns which profile and parameter, -and whether each parameter is free, fixed or solved — and the `info` is the **legend**, holding the priors and -values themselves. - -Because this is the same model as tutorial 1, it is the same map: the `galaxies` frame holding a -`lens · Galaxy` card at `redshift = 0.5` with its `mass · IsothermalSph` profile, a `source · Galaxy` card at -`redshift = 1.0` with its `bulge · ExponentialCoreSph` and its dashed `intensity · solved` pill, and a footer -reading `6 unique sampled scalars`. Nothing in this tutorial changes the model — every setting we discuss -below belongs to the search, and the search is not drawn on this map. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +Nothing in this tutorial changes the model — every setting we discuss below belongs to the search. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py b/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py index ed9282f..129cda5 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py +++ b/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py @@ -224,19 +224,16 @@ print(model.info) """ -Drawing the model makes plain why this fit is so much harder than the one in tutorial 1. The figure is the -**map** of the model, showing its structure and the state of every parameter, whilst the `info` above is the -**legend**, holding the priors we just customized. - -The `lens · Galaxy` card now holds three profile cards rather than one: `bulge · Sersic`, `mass · Isothermal` -and `shear · ExternalShear`. Every pill is white, meaning every parameter is free, and the footer counts -`20 unique sampled scalars` against the six of tutorial 1. Note also that these are *ordinary* light profiles -rather than the linear ones we have been using: `intensity` appears as a plain free pill on both `bulge` cards -instead of the dashed `intensity · solved` we saw before, so the search has to sample it. Tutorial 5 will take -those two dimensions back. - -The priors we tightened above are nowhere on this map, because a prior is a number and numbers belong to the -legend. The map's job here is to show you the *size* of the problem the priors are helping with. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +This model has twenty free parameters against the six of tutorial 1, which is why this fit is so much harder. +Note also that it uses *ordinary* light profiles rather than the linear ones we have been using, so the search +has to sample each `intensity` itself. Tutorial 5 will take those two dimensions back. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py b/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py index da1b8de..a0124e8 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py +++ b/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py @@ -150,16 +150,12 @@ print(model.info) """ -The figure shows the linear light profiles in a way the `info` cannot. On both `bulge` cards — the lens's -`Sersic` and the source's `ExponentialCore` — the final pill is drawn with a dashed outline and reads -`intensity · solved`, and the figure's legend line spells the dash out as *solved during fitting*. The footer -then separates the two kinds of quantity for you: `18 unique sampled scalars`, the dimensions the search -actually explores, and `2 parameters solved during fitting`, the intensities the inversion computes exactly at -every likelihood evaluation. - -This is precisely the distinction the section above is making. In the `info` the `intensity` is simply absent, -and an absence is a hard thing to notice; on the map it is present but visibly marked as belonging to a -different machine. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py b/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py index cf4ee35..da1f17b 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py +++ b/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py @@ -168,12 +168,12 @@ print(model_1.info) """ -The map of `model_1` shows the three kinds of simplification we just made, each drawn differently. The `centre` -pills on `bulge · Sersic` and `mass · Isothermal` are greyed out, as is `sersic_index`: grey means fixed to a -value and removed from the search. `ell_comps` carries a blue `shared ×2` badge on the bulge and an -`↗ bulge.ell_comps` reference on the mass, with a bracket joining them — the pairing. And `intensity · solved` -sits dashed on both linear light profiles. The footer adds it all up: `11 unique sampled scalars`, `10 fixed -leaf slots`, `2 shared priors` and `2 parameters solved during fitting`. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. Eleven dimensions is a deliberately crude model, and that is exactly what the first search in a chain wants: it needs only to be good enough to locate the lens roughly, and to do so quickly. diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.py b/scripts/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.py index d11df6e..8c25e10 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.py @@ -389,22 +389,16 @@ print(model.info) """ -The model can also be drawn, and this is the first model in the series with a genuinely new *shape* rather than -simply new profiles. The figure is the **map** — the structure of the model, which galaxy owns which profile and -parameter, and whether each parameter is free, fixed or solved for during the fit — and the `info` above is the -**legend**, holding the priors and fixed values themselves. - -The new shape is immediately visible: there are now two top-level frames side by side rather than one. The -familiar `galaxies` frame holds `lens · Galaxy` and `source · Galaxy`, and beside it sits a second frame titled -`extra_galaxies`, holding the card `0 · Galaxy` at `redshift = 0.5` with its own `light · ExponentialSph` and -`mass · IsothermalSph` profiles. That second frame is the `extra_galaxies` input to the `Collection` drawn as a -picture: the interloper is part of the model and part of the ray-tracing, but it is visibly neither the lens nor -the source. - -Then look at what the extra galaxy costs. Both of its `centre` pills are greyed out — fixed to the centre we -measured from the data — and its `light` card carries the dashed `intensity · solved` pill, so only -`effective_radius` and `einstein_radius` are left white. The footer reads `21 unique sampled scalars`, just two -more than the same lens-and-source model would score without it: an entire extra galaxy for two dimensions. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +The extra galaxy is part of the model and part of the ray-tracing, but it is neither the lens nor the source. +Its centres are fixed to the values we measured from the data and its light is linear, so an entire extra galaxy +costs just two more free parameters than the same lens-and-source model without it. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py b/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py index d94acea..278aa1c 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py @@ -205,20 +205,16 @@ print(model.info) """ -Drawing the model shows the multi-galaxy regime at a glance. The figure is the **map** of the model's structure -and the `info` is the **legend** of its priors; here it is the map that carries the news. - -Inside the `galaxies` frame there are now three cards rather than two: `lens_0 · Galaxy` and `lens_1 · Galaxy`, -both at `redshift = 0.5`, above the single `source · Galaxy` at `redshift = 1.0`. Each deflector card holds its -own `mass · Isothermal` with three white pills — `centre`, `ell_comps`, `einstein_radius` — two independent, -fully free mass models. That is the defining feature of this regime, and the thing every earlier chapter lacked. - -Each galaxy's light is drawn as a `bulge · Basis` card wrapping a dashed **plate**: one `Gaussian` card badged -`20 components`, standing for all twenty Gaussians of the MGE, with `centre` and `ell_comps` carrying blue -`shared across group` badges, `sigma` reading `fixed, varies by member` and `intensity` dashed as -`intensity · solved`. The footer does the accounting: `22 unique sampled scalars` — the same number the -`prior_count` prints below — alongside `63 fixed leaf slots`, `60 parameters solved during fitting` and -`3 plates standing for 60 components`. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +Each deflector has its own `mass · Isothermal` with a free `centre`, `ell_comps` and `einstein_radius`: two +independent, fully free mass models. That is the defining feature of this regime, and the thing every earlier +chapter lacked. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.py b/scripts/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.py index 435c8a8..3b3bea8 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.py @@ -347,23 +347,15 @@ print(model.info) """ -This is the model whose map is worth the most, because the scaling relation is a piece of structure the `info` -can only describe in words. The figure is the **map** — what the model is made of and how its parts are tied -together — and the `info` is the **legend** of priors and values. - -Two top-level frames again, but not the pair from tutorial 1: `galaxies` holds `lens · Galaxy` (the anchor) and -`source · Galaxy`, and below it a frame titled `scaling_galaxies` holds the tied member as `0 · Galaxy`. All -three galaxies wear a `bulge · Basis` plate, a `Gaussian` card badged `10 components`; on the two lens galaxies -its caption reads `Gaussian with priors centre fixed, ell_comps ⇄ shared, sigma fixed (varies by member), -intensity solved`, which is the MGE costing two free parameters apiece, exactly as claimed above. - -Now look at the tied galaxy's `mass · IsothermalSph` card. Where the anchor has a plain white `einstein_radius` -pill, the tied galaxy has an amber **expression** pill spelling the relation out in full — -`einstein_radius = galaxies.lens.mass.einstein_radius * ` — with an amber dashed line running -across the figure from the anchor's `einstein_radius` pill to it. The figure's legend names this state -`relation (expression shown)`, and it is a state no amount of reading priors can reveal: the tied radius has no -prior, because it is not a parameter. The footer's `11 unique sampled scalars` counts the anchor's radius once -and the tied galaxy's not at all. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +The tied galaxy's `einstein_radius` is not sampled at all. It is computed from the anchor lens galaxy's via the +scaling relation, so it has no prior, because it is not a parameter. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py b/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py index fa94eb4..b747d25 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py @@ -421,20 +421,12 @@ print(model.info) """ -The figure is the **map** of this model and the `info` is its **legend**; at group scale the map begins doing -real work, because the model now contains a population rather than a handful of named galaxies. - -The `galaxies` frame holds the two individually-modelled cards, `lens · Galaxy` (the BGG, with its -`bulge · SersicSph` and `mass · IsothermalSph`) and `source · Galaxy`. Beside them the `extra_galaxies` frame -holds not two cards but one dashed **plate**: a `Galaxy` card badged `2 components` and subtitled -`0 - 1 · redshift = 0.5`, standing for both members at once. The plate's pills say what the members have in -common and how they differ — `centre · fixed, varies by member` (every member's centre is fixed, each to its own -value), and `effective_radius`, `sersic_index` and `sigma` each badged `independent`, which the figure's legend -glosses as *one prior per member*. The `r_core`, `r_cut`, `redshift_object`, `redshift_source`, `H0` and `Om0` -pills are grey: the pinned dPIE constants. - -The footer reads `19 unique sampled scalars` — the N=19 the line below prints — with `1 plate standing for 2 -components`. Hold on to that number and that plate: the next model changes both. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.py b/scripts/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.py index c936e4e..3c232a7 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.py @@ -416,25 +416,16 @@ print(model.info) """ -This figure is the punchline of the chapter, and it repays reading slowly. The map shows the model's structure; -the `info` above is the legend of its priors. - -Each of the four tiers described above is drawn as its own object. The `galaxies` frame opens with a dashed -**plate** — `Galaxy` badged `2 components`, subtitled `lens_0 · lens_1 · redshift = 0.5` — standing for both -main galaxies at once: on its `mass · dPIEMassSph` card, `centre · fixed, varies by member` is grey, `sigma` and -`r_cut` are badged `independent` (one free prior per member), and `r_core`, the two redshifts and `H0` / `Om0` -are grey pinned constants. Below it the host halo appears as an ordinary card, `host_halo · Galaxy`, holding -`dark · NFWMCRLudlowSph` with exactly one white pill, `mass_at_200`. Below that a second plate, `Galaxy` badged -`2 components` and subtitled `source_0 · source_1`, holds `point_0 · PointSolved` whose only pill is the dashed -`centre · solved` — the source centres solved for rather than sampled. - -The second top-level frame, `scaling_galaxies`, holds the member tier: a plate badged `9 components` and one -card, `9 · Galaxy`, standing apart from it, and on both the `sigma` pill is an amber expression reading -`sigma = scaling_galaxies.9.mass.sigma.scaling_sigma_ref * `. Ten members, one free prior. - -Now read the footer: `6 unique sampled scalars`, `113 fixed leaf slots`, `2 parameters solved during fitting` -and `3 plates standing for 13 components`. Thirteen galaxies and two sources, six dimensions. The `info` needs -a hundred lines to say that; the map says it in one picture, and the six white pills are countable at a glance. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +Thirteen galaxies and two sources are modelled with six free parameters. That compression — main galaxies and +sources sharing priors, one halo, and a scaling relation tying ten members to a single free prior — is what makes +a cluster-scale model tractable at all. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.py b/scripts/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.py index 2841a02..d4b113d 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.py @@ -334,19 +334,15 @@ print(model.info) """ -The map of a weak-lensing model is the smallest in the series, and that is the point of drawing it. The figure -shows the model's structure; the `info` above lists its priors. - -Inside the `galaxies` frame, `lens · Galaxy` at `redshift = 0.5` holds a single `mass · Isothermal` card with -three white pills — `centre`, `ell_comps` and `einstein_radius` — and `source · Galaxy` at `redshift = 1.0` -holds nothing at all: its card carries the line `no parameters` where every other source in this series has had -a light profile. In weak lensing the source galaxies are the *data*, a catalogue of measured shapes, so there is -no source light to fit. The footer reads `5 unique sampled scalars`, against the twenty-plus of the imaging -tutorials. - -Set this map beside the cluster model's from the previous tutorial and you have the two extremes of the chapter -in one comparison: fifteen galaxies in six dimensions there, two galaxies in five here — and in both cases the -figure tells you the dimensionality far faster than scrolling through `info` ever could. +The same model can also be visualized as a figure, making its structure easier to understand at a glance. + +The figure shows how the model is organized: which parameters belong to each component, and whether they are free, +fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the +corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed +parameter. + +In weak lensing the source galaxies are the *data*, a catalogue of measured shapes, so there is no source light +to fit and the source galaxy in this model carries no light profile at all. """ af.ModelPlotter(model).figure() From c22431269f10640c7d9a8c09cba0a9a7c931583d Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 14 Sep 2026 20:55:19 +0100 Subject: [PATCH 2/3] Regenerate notebook twins for the collapsed model-figure prose Notebooks are generated, never hand-edited: 12 twins regenerated from their scripts with ../PyAutoHands/autohands/generate.py howtolens. llms-full.txt and workspace_index.json were rewritten unchanged. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01LPCvGNHahZqynPyEfMijsb --- .../tutorial_10_prior_passing.ipynb | 15 +++++---- .../tutorial_1_non_linear_search.ipynb | 32 ++++++------------- .../tutorial_2_practicalities.ipynb | 18 +++++------ .../tutorial_4_dealing_with_failure.ipynb | 23 ++++++------- .../tutorial_5_linear_profiles.ipynb | 16 ++++------ .../tutorial_9_search_chaining.ipynb | 12 +++---- .../tutorial_1_extra_galaxies.ipynb | 26 ++++++--------- .../tutorial_2_multi_galaxy.ipynb | 24 ++++++-------- .../tutorial_3_scaling_relation.ipynb | 26 ++++++--------- .../tutorial_4_group_scale.ipynb | 20 ++++-------- .../tutorial_5_cluster_scale.ipynb | 29 ++++++----------- .../tutorial_6_weak_lensing.ipynb | 22 ++++++------- 12 files changed, 102 insertions(+), 161 deletions(-) diff --git a/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb index d0ef931..6767737 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb @@ -212,13 +212,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This is the same model as the first search of the previous tutorial, so it is the same map: greyed `centre` and\n", - "`sersic_index` pills for the parameters fixed to values, the blue `shared \u00d72` and `\u2197 bulge.ell_comps` pair\n", - "joining the mass's ellipticity to the bulge's, dashed `intensity \u00b7 solved` pills on both linear light profiles,\n", - "and a footer of `11 unique sampled scalars`.\n", + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", "\n", - "Hold this map in mind as you read the second model below. This tutorial is about what changes between the two \u2014\n", - "and, more importantly, about what does not." + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "This is the same model as the first search of the previous tutorial. Keep it in mind as you read the second\n", + "model below: this tutorial is about what prior passing changes between the two and, more importantly, about what\n", + "it does not." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb index d50729c..a6f6268 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb @@ -436,29 +436,15 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The same model can also be drawn as a figure, via `af.ModelPlotter`.\n", - "\n", - "The figure and the `info` are two views of the same model, and it is worth being precise about the division of\n", - "labour between them. The figure is the **map**: it shows the structure of the model, meaning which galaxy owns\n", - "which profile, which profile owns which parameter, and what state every parameter is in \u2014 free, fixed to a\n", - "value, shared with another parameter, related to one by an expression, or solved for during the fit rather than\n", - "sampled. The `info` printed above is the **legend**: it lists the priors and values themselves, the numbers the\n", - "map has no room for.\n", - "\n", - "Read this first map from the outside in. The outer frame is titled `galaxies`, after the `Collection` we just\n", - "composed. Inside it sit two cards, `lens \u00b7 Galaxy` and `source \u00b7 Galaxy`, each labelled underneath with its\n", - "redshift, `redshift = 0.5` and `redshift = 1.0` \u2014 which is how **PyAutoLens** knows which galaxy does the\n", - "lensing and which one is lensed. Inside the lens card is a single profile card, `mass \u00b7 IsothermalSph`, holding\n", - "the pills `centre` (carrying a `2D` badge, because a centre is a tuple of two coordinates) and `einstein_radius`.\n", - "Inside the source card is `bulge \u00b7 ExponentialCoreSph`, whose greyed-out `radius_break`, `gamma` and `alpha`\n", - "pills mark parameters fixed to default values, and whose dashed `intensity \u00b7 solved` pill marks the one\n", - "parameter that is not sampled at all: because this is a linear light profile, its `intensity` is solved for by\n", - "linear algebra at every likelihood evaluation. The footer totals the model up as `6 unique sampled scalars`,\n", - "`5 fixed leaf slots` and `1 parameter solved during fitting`.\n", - "\n", - "Draw the map every time you compose a model. It fits on one screen now and may look like a redundant restatement\n", - "of the `info`, but the two views scale very differently: by chapter 4 our models hold fifteen galaxies and their\n", - "`info` runs to hundreds of lines, whilst the map still fits in a glance." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "Each galaxy is labelled with its redshift, `redshift = 0.5` for the lens and `redshift = 1.0` for the source.\n", + "That is how **PyAutoLens** knows which galaxy does the lensing and which one is lensed." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb index 30567b3..4856ff5 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb @@ -284,16 +284,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "As in the previous tutorial we also draw the model, remembering the division of labour between the two views:\n", - "the figure is the **map**, showing the structure of the model \u2014 which galaxy owns which profile and parameter,\n", - "and whether each parameter is free, fixed or solved \u2014 and the `info` is the **legend**, holding the priors and\n", - "values themselves.\n", - "\n", - "Because this is the same model as tutorial 1, it is the same map: the `galaxies` frame holding a\n", - "`lens \u00b7 Galaxy` card at `redshift = 0.5` with its `mass \u00b7 IsothermalSph` profile, a `source \u00b7 Galaxy` card at\n", - "`redshift = 1.0` with its `bulge \u00b7 ExponentialCoreSph` and its dashed `intensity \u00b7 solved` pill, and a footer\n", - "reading `6 unique sampled scalars`. Nothing in this tutorial changes the model \u2014 every setting we discuss\n", - "below belongs to the search, and the search is not drawn on this map." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "Nothing in this tutorial changes the model \u2014 every setting we discuss below belongs to the search." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb index 4e82a8f..e16865e 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb @@ -431,19 +431,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Drawing the model makes plain why this fit is so much harder than the one in tutorial 1. The figure is the\n", - "**map** of the model, showing its structure and the state of every parameter, whilst the `info` above is the\n", - "**legend**, holding the priors we just customized.\n", - "\n", - "The `lens \u00b7 Galaxy` card now holds three profile cards rather than one: `bulge \u00b7 Sersic`, `mass \u00b7 Isothermal`\n", - "and `shear \u00b7 ExternalShear`. Every pill is white, meaning every parameter is free, and the footer counts\n", - "`20 unique sampled scalars` against the six of tutorial 1. Note also that these are *ordinary* light profiles\n", - "rather than the linear ones we have been using: `intensity` appears as a plain free pill on both `bulge` cards\n", - "instead of the dashed `intensity \u00b7 solved` we saw before, so the search has to sample it. Tutorial 5 will take\n", - "those two dimensions back.\n", - "\n", - "The priors we tightened above are nowhere on this map, because a prior is a number and numbers belong to the\n", - "legend. The map's job here is to show you the *size* of the problem the priors are helping with." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "This model has twenty free parameters against the six of tutorial 1, which is why this fit is so much harder.\n", + "Note also that it uses *ordinary* light profiles rather than the linear ones we have been using, so the search\n", + "has to sample each `intensity` itself. Tutorial 5 will take those two dimensions back." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb index ff865a7..37d3aa2 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb @@ -269,16 +269,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The figure shows the linear light profiles in a way the `info` cannot. On both `bulge` cards \u2014 the lens's\n", - "`Sersic` and the source's `ExponentialCore` \u2014 the final pill is drawn with a dashed outline and reads\n", - "`intensity \u00b7 solved`, and the figure's legend line spells the dash out as *solved during fitting*. The footer\n", - "then separates the two kinds of quantity for you: `18 unique sampled scalars`, the dimensions the search\n", - "actually explores, and `2 parameters solved during fitting`, the intensities the inversion computes exactly at\n", - "every likelihood evaluation.\n", - "\n", - "This is precisely the distinction the section above is making. In the `info` the `intensity` is simply absent,\n", - "and an absence is a hard thing to notice; on the map it is present but visibly marked as belonging to a\n", - "different machine." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb index 125f0dd..3ef05d9 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb @@ -309,12 +309,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The map of `model_1` shows the three kinds of simplification we just made, each drawn differently. The `centre`\n", - "pills on `bulge \u00b7 Sersic` and `mass \u00b7 Isothermal` are greyed out, as is `sersic_index`: grey means fixed to a\n", - "value and removed from the search. `ell_comps` carries a blue `shared \u00d72` badge on the bulge and an\n", - "`\u2197 bulge.ell_comps` reference on the mass, with a bracket joining them \u2014 the pairing. And `intensity \u00b7 solved`\n", - "sits dashed on both linear light profiles. The footer adds it all up: `11 unique sampled scalars`, `10 fixed\n", - "leaf slots`, `2 shared priors` and `2 parameters solved during fitting`.\n", + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", "\n", "Eleven dimensions is a deliberately crude model, and that is exactly what the first search in a chain wants: it\n", "needs only to be good enough to locate the lens roughly, and to do so quickly." diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb index 7e76259..9e4a3f8 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_1_extra_galaxies.ipynb @@ -597,22 +597,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The model can also be drawn, and this is the first model in the series with a genuinely new *shape* rather than\n", - "simply new profiles. The figure is the **map** \u2014 the structure of the model, which galaxy owns which profile and\n", - "parameter, and whether each parameter is free, fixed or solved for during the fit \u2014 and the `info` above is the\n", - "**legend**, holding the priors and fixed values themselves.\n", - "\n", - "The new shape is immediately visible: there are now two top-level frames side by side rather than one. The\n", - "familiar `galaxies` frame holds `lens \u00b7 Galaxy` and `source \u00b7 Galaxy`, and beside it sits a second frame titled\n", - "`extra_galaxies`, holding the card `0 \u00b7 Galaxy` at `redshift = 0.5` with its own `light \u00b7 ExponentialSph` and\n", - "`mass \u00b7 IsothermalSph` profiles. That second frame is the `extra_galaxies` input to the `Collection` drawn as a\n", - "picture: the interloper is part of the model and part of the ray-tracing, but it is visibly neither the lens nor\n", - "the source.\n", - "\n", - "Then look at what the extra galaxy costs. Both of its `centre` pills are greyed out \u2014 fixed to the centre we\n", - "measured from the data \u2014 and its `light` card carries the dashed `intensity \u00b7 solved` pill, so only\n", - "`effective_radius` and `einstein_radius` are left white. The footer reads `21 unique sampled scalars`, just two\n", - "more than the same lens-and-source model would score without it: an entire extra galaxy for two dimensions." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "The extra galaxy is part of the model and part of the ray-tracing, but it is neither the lens nor the source.\n", + "Its centres are fixed to the values we measured from the data and its light is linear, so an entire extra galaxy\n", + "costs just two more free parameters than the same lens-and-source model without it." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb index ad94b06..d1295b6 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb @@ -325,20 +325,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Drawing the model shows the multi-galaxy regime at a glance. The figure is the **map** of the model's structure\n", - "and the `info` is the **legend** of its priors; here it is the map that carries the news.\n", - "\n", - "Inside the `galaxies` frame there are now three cards rather than two: `lens_0 \u00b7 Galaxy` and `lens_1 \u00b7 Galaxy`,\n", - "both at `redshift = 0.5`, above the single `source \u00b7 Galaxy` at `redshift = 1.0`. Each deflector card holds its\n", - "own `mass \u00b7 Isothermal` with three white pills \u2014 `centre`, `ell_comps`, `einstein_radius` \u2014 two independent,\n", - "fully free mass models. That is the defining feature of this regime, and the thing every earlier chapter lacked.\n", - "\n", - "Each galaxy's light is drawn as a `bulge \u00b7 Basis` card wrapping a dashed **plate**: one `Gaussian` card badged\n", - "`20 components`, standing for all twenty Gaussians of the MGE, with `centre` and `ell_comps` carrying blue\n", - "`shared across group` badges, `sigma` reading `fixed, varies by member` and `intensity` dashed as\n", - "`intensity \u00b7 solved`. The footer does the accounting: `22 unique sampled scalars` \u2014 the same number the\n", - "`prior_count` prints below \u2014 alongside `63 fixed leaf slots`, `60 parameters solved during fitting` and\n", - "`3 plates standing for 60 components`." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "Each deflector has its own `mass \u00b7 Isothermal` with a free `centre`, `ell_comps` and `einstein_radius`: two\n", + "independent, fully free mass models. That is the defining feature of this regime, and the thing every earlier\n", + "chapter lacked." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.ipynb index 0a00a28..e622ca8 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_3_scaling_relation.ipynb @@ -511,23 +511,15 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This is the model whose map is worth the most, because the scaling relation is a piece of structure the `info`\n", - "can only describe in words. The figure is the **map** \u2014 what the model is made of and how its parts are tied\n", - "together \u2014 and the `info` is the **legend** of priors and values.\n", - "\n", - "Two top-level frames again, but not the pair from tutorial 1: `galaxies` holds `lens \u00b7 Galaxy` (the anchor) and\n", - "`source \u00b7 Galaxy`, and below it a frame titled `scaling_galaxies` holds the tied member as `0 \u00b7 Galaxy`. All\n", - "three galaxies wear a `bulge \u00b7 Basis` plate, a `Gaussian` card badged `10 components`; on the two lens galaxies\n", - "its caption reads `Gaussian with priors centre fixed, ell_comps \u21c4 shared, sigma fixed (varies by member),\n", - "intensity solved`, which is the MGE costing two free parameters apiece, exactly as claimed above.\n", - "\n", - "Now look at the tied galaxy's `mass \u00b7 IsothermalSph` card. Where the anchor has a plain white `einstein_radius`\n", - "pill, the tied galaxy has an amber **expression** pill spelling the relation out in full \u2014\n", - "`einstein_radius = galaxies.lens.mass.einstein_radius * ` \u2014 with an amber dashed line running\n", - "across the figure from the anchor's `einstein_radius` pill to it. The figure's legend names this state\n", - "`relation (expression shown)`, and it is a state no amount of reading priors can reveal: the tied radius has no\n", - "prior, because it is not a parameter. The footer's `11 unique sampled scalars` counts the anchor's radius once\n", - "and the tied galaxy's not at all." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "The tied galaxy's `einstein_radius` is not sampled at all. It is computed from the anchor lens galaxy's via the\n", + "scaling relation, so it has no prior, because it is not a parameter." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb index 40c905a..9dcd199 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb @@ -618,20 +618,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The figure is the **map** of this model and the `info` is its **legend**; at group scale the map begins doing\n", - "real work, because the model now contains a population rather than a handful of named galaxies.\n", - "\n", - "The `galaxies` frame holds the two individually-modelled cards, `lens \u00b7 Galaxy` (the BGG, with its\n", - "`bulge \u00b7 SersicSph` and `mass \u00b7 IsothermalSph`) and `source \u00b7 Galaxy`. Beside them the `extra_galaxies` frame\n", - "holds not two cards but one dashed **plate**: a `Galaxy` card badged `2 components` and subtitled\n", - "`0 - 1 \u00b7 redshift = 0.5`, standing for both members at once. The plate's pills say what the members have in\n", - "common and how they differ \u2014 `centre \u00b7 fixed, varies by member` (every member's centre is fixed, each to its own\n", - "value), and `effective_radius`, `sersic_index` and `sigma` each badged `independent`, which the figure's legend\n", - "glosses as *one prior per member*. The `r_core`, `r_cut`, `redshift_object`, `redshift_source`, `H0` and `Om0`\n", - "pills are grey: the pinned dPIE constants.\n", - "\n", - "The footer reads `19 unique sampled scalars` \u2014 the N=19 the line below prints \u2014 with `1 plate standing for 2\n", - "components`. Hold on to that number and that plate: the next model changes both." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.ipynb index b26f4e7..a2415ac 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.ipynb @@ -624,25 +624,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This figure is the punchline of the chapter, and it repays reading slowly. The map shows the model's structure;\n", - "the `info` above is the legend of its priors.\n", - "\n", - "Each of the four tiers described above is drawn as its own object. The `galaxies` frame opens with a dashed\n", - "**plate** \u2014 `Galaxy` badged `2 components`, subtitled `lens_0 \u00b7 lens_1 \u00b7 redshift = 0.5` \u2014 standing for both\n", - "main galaxies at once: on its `mass \u00b7 dPIEMassSph` card, `centre \u00b7 fixed, varies by member` is grey, `sigma` and\n", - "`r_cut` are badged `independent` (one free prior per member), and `r_core`, the two redshifts and `H0` / `Om0`\n", - "are grey pinned constants. Below it the host halo appears as an ordinary card, `host_halo \u00b7 Galaxy`, holding\n", - "`dark \u00b7 NFWMCRLudlowSph` with exactly one white pill, `mass_at_200`. Below that a second plate, `Galaxy` badged\n", - "`2 components` and subtitled `source_0 \u00b7 source_1`, holds `point_0 \u00b7 PointSolved` whose only pill is the dashed\n", - "`centre \u00b7 solved` \u2014 the source centres solved for rather than sampled.\n", - "\n", - "The second top-level frame, `scaling_galaxies`, holds the member tier: a plate badged `9 components` and one\n", - "card, `9 \u00b7 Galaxy`, standing apart from it, and on both the `sigma` pill is an amber expression reading\n", - "`sigma = scaling_galaxies.9.mass.sigma.scaling_sigma_ref * `. Ten members, one free prior.\n", - "\n", - "Now read the footer: `6 unique sampled scalars`, `113 fixed leaf slots`, `2 parameters solved during fitting`\n", - "and `3 plates standing for 13 components`. Thirteen galaxies and two sources, six dimensions. The `info` needs\n", - "a hundred lines to say that; the map says it in one picture, and the six white pills are countable at a glance." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "Thirteen galaxies and two sources are modelled with six free parameters. That compression \u2014 main galaxies and\n", + "sources sharing priors, one halo, and a scaling relation tying ten members to a single free prior \u2014 is what makes\n", + "a cluster-scale model tractable at all." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.ipynb index b46a2a7..dd25e0e 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_6_weak_lensing.ipynb @@ -498,19 +498,15 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The map of a weak-lensing model is the smallest in the series, and that is the point of drawing it. The figure\n", - "shows the model's structure; the `info` above lists its priors.\n", - "\n", - "Inside the `galaxies` frame, `lens \u00b7 Galaxy` at `redshift = 0.5` holds a single `mass \u00b7 Isothermal` card with\n", - "three white pills \u2014 `centre`, `ell_comps` and `einstein_radius` \u2014 and `source \u00b7 Galaxy` at `redshift = 1.0`\n", - "holds nothing at all: its card carries the line `no parameters` where every other source in this series has had\n", - "a light profile. In weak lensing the source galaxies are the *data*, a catalogue of measured shapes, so there is\n", - "no source light to fit. The footer reads `5 unique sampled scalars`, against the twenty-plus of the imaging\n", - "tutorials.\n", - "\n", - "Set this map beside the cluster model's from the previous tutorial and you have the two extremes of the chapter\n", - "in one comparison: fifteen galaxies in six dimensions there, two galaxies in five here \u2014 and in both cases the\n", - "figure tells you the dimensionality far faster than scrolling through `info` ever could." + "The same model can also be visualized as a figure, making its structure easier to understand at a glance.\n", + "\n", + "The figure shows how the model is organized: which parameters belong to each component, and whether they are free,\n", + "fixed, shared, linked by an expression, solved during the fit, or not configured. `model.info` provides the\n", + "corresponding numerical details, including the prior assigned to each free parameter and the value of each fixed\n", + "parameter.\n", + "\n", + "In weak lensing the source galaxies are the *data*, a catalogue of measured shapes, so there is no source light\n", + "to fit and the source galaxy in this model carries no light profile at all." ] }, { From 77e33005009574d6eec54a862776ebc210420e7f Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 14 Sep 2026 20:59:40 +0100 Subject: [PATCH 3/3] Model figures: strip figure vocabulary from the later-site notes The first-figure blocks were collapsed to the canonical two paragraphs in the previous commit; the notes at second and third figure sites still described how the figure renders a model rather than the model. Every such note is rewritten, not deleted: clauses whose subject is a pill, plate, badge, card, footer count or "the map" / "the legend" are dropped, and every statement of fact about the model, and every sentence teaching the tutorial's own science or method, is kept and reworded to stand on its own. 8 notes across 7 tutorials. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01LPCvGNHahZqynPyEfMijsb --- .../tutorial_10_prior_passing.ipynb | 18 +++++-------- .../tutorial_1_non_linear_search.ipynb | 8 ++---- .../tutorial_4_dealing_with_failure.ipynb | 14 ++++------- .../tutorial_5_linear_profiles.ipynb | 18 +++++-------- .../tutorial_9_search_chaining.ipynb | 11 ++++---- .../tutorial_2_multi_galaxy.ipynb | 15 +++++------ .../tutorial_4_group_scale.ipynb | 25 ++++++++----------- .../tutorial_10_prior_passing.py | 18 +++++-------- .../tutorial_1_non_linear_search.py | 8 ++---- .../tutorial_4_dealing_with_failure.py | 14 ++++------- .../tutorial_5_linear_profiles.py | 18 +++++-------- .../tutorial_9_search_chaining.py | 11 ++++---- .../tutorial_2_multi_galaxy.py | 15 +++++------ .../tutorial_4_group_scale.py | 25 ++++++++----------- 14 files changed, 82 insertions(+), 136 deletions(-) diff --git a/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb index 6767737..812c9ca 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_10_prior_passing.ipynb @@ -405,18 +405,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Here is the lesson of this tutorial, drawn. Prior passing moves the **legend** and leaves the **map** alone:\n", - "almost every number in the `info` above has been replaced by a narrow prior centred on search 1's result, and\n", - "not one of those replacements shows up in the figure, because a prior is a number and numbers are not structure.\n", - "\n", - "What the map *does* show are the two changes we made deliberately, and separately from the passing itself: the\n", - "`centre` and `sersic_index` pills are white rather than grey (we chose not to pass those, so they are free\n", - "again, and the blue bracket between bulge and mass is gone with them), and the source's card is now\n", - "`bulge \u00b7 Sersic` rather than `bulge \u00b7 ExponentialCore` \u2014 the upgrade `take_attributes` exists to make possible.\n", - "The footer moves from `11 unique sampled scalars` to `19`.\n", - "\n", - "This is a good habit when chaining searches: draw both models. Every difference you see on the map is a\n", - "structural decision you made on purpose; everything else the chain did for you is in the legend." + "Prior passing replaces almost every number in the `info` above with a narrow prior centred on search 1's result,\n", + "but it changes nothing about the model's structure, because a prior is a number and numbers are not structure.\n", + "\n", + "The two changes we made deliberately, and separately from the passing itself, are structural: `centre` and\n", + "`sersic_index` are free again, because we chose not to pass those, and the source is now a `Sersic` rather than\n", + "an `ExponentialCore` \u2014 the upgrade `take_attributes` exists to make possible." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb index a6f6268..237f7cf 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_1_non_linear_search.ipynb @@ -536,12 +536,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Drawing the model again makes the point sharply: the map is identical to the one above. Priors live in the\n", - "legend, not on the map, so customizing them changes many numbers in the `info` and nothing at all in the figure.\n", - "\n", - "That is exactly what you want from the two views. When you tune priors you are changing where the search looks,\n", - "not what it is looking for, and an unchanged map is the visual confirmation that you have not accidentally\n", - "changed the model itself whilst editing it." + "Customizing priors changes many numbers in the `info` and nothing at all about the model itself. When you tune\n", + "priors you are changing where the search looks, not what it is looking for." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb index e16865e..353fb76 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.ipynb @@ -641,15 +641,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now the map earns its keep. On the `mass \u00b7 Isothermal` card the `centre` and `ell_comps` pills are no longer\n", - "free parameters of their own: each carries a blue reference badge reading `\u2197 bulge.centre` and\n", - "`\u2197 bulge.ell_comps`, and a blue bracket runs down the side of the figure joining them to the matching\n", - "`shared \u00d72` badges on the `bulge \u00b7 Sersic` card. That bracket *is* the light-traces-mass assumption, drawn.\n", - "The footer confirms the saving: `16 unique sampled scalars` and `4 shared priors`, down from the twenty of the\n", - "previous model.\n", - "\n", - "Pairing parameters is easy to get subtly wrong and hard to spot in a long `info` listing, but trivial to check\n", - "on the map. Whenever you pair parameters, draw the model and confirm the brackets land where you meant them to." + "The `mass \u00b7 Isothermal`'s `centre` and `ell_comps` are no longer free parameters of their own: each is tied to\n", + "the matching parameter of the `bulge \u00b7 Sersic`. That pairing *is* the light-traces-mass assumption, and it takes\n", + "the model from twenty free parameters down to sixteen.\n", + "\n", + "Pairing parameters is easy to get subtly wrong and hard to spot in a long `info` listing." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb index 37d3aa2..0e58bd5 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_5_linear_profiles.ipynb @@ -727,18 +727,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `info` for this model is enormous \u2014 forty-five Gaussians, each with its own block of parameters. The map is\n", - "not, because it collapses repetition into **plates**. Each `bulge \u00b7 Basis` card holds a `profile_list` frame\n", - "containing one dashed plate: a single `Gaussian` card badged `30 components` on the lens and `15 components` on\n", - "the source, with the index range (`0 - 29`, `0 - 14`) printed beneath the title. A plate says \"this one card\n", - "stands for all of these components\", and its pills describe what every member of the plate has in common:\n", - "`centre` and `ell_comps` carry blue `shared across group` badges, `sigma` reads `fixed, varies by member`, and\n", - "`intensity` is the familiar dashed `intensity \u00b7 solved`. The caption under the plate repeats it in words,\n", - "`Gaussian with priors centre \u21c4 shared, ell_comps \u21c4 shared, sigma fixed (varies by member), intensity solved`.\n", - "\n", - "That is the whole MGE trick in one line of the figure, and the footer proves the arithmetic: `13 unique sampled\n", - "scalars` alongside `47 fixed leaf slots`, `45 parameters solved during fitting` and `2 plates standing for 45\n", - "components`. Forty-five Gaussians, thirteen dimensions \u2014 the N=13 quoted above." + "The `info` for this model is enormous \u2014 forty-five Gaussians, each with its own block of parameters \u2014 but the\n", + "model itself is small. Each `bulge \u00b7 Basis` holds a single `Gaussian` repeated thirty times on the lens and\n", + "fifteen times on the source, and every member of a basis shares one `centre` and one `ell_comps`, has its own\n", + "fixed `sigma`, and has its `intensity` solved by the inversion.\n", + "\n", + "That is the whole MGE trick: forty-five Gaussians, thirteen dimensions \u2014 the N=13 quoted above." ] }, { diff --git a/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb b/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb index 3ef05d9..e817be4 100644 --- a/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb +++ b/notebooks/chapter_2_lens_modeling/tutorial_9_search_chaining.ipynb @@ -588,13 +588,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The second model's map is the comparison worth making. Every grey pill has turned white \u2014 the centres and the\n", - "`sersic_index` are free again \u2014 the blue bracket between `bulge` and `mass` has gone with them, and the source's\n", - "card is now a `Sersic` carrying a `sersic_index` pill of its own. The footer reads `19 unique sampled scalars`\n", - "against the eleven of `model_1`.\n", + "The second model is the comparison worth making. The centres and the `sersic_index` are free again, the pairing\n", + "between `bulge` and `mass` has gone with them, and the source is now a `Sersic` with a `sersic_index` of its\n", + "own: nineteen free parameters against the eleven of `model_1`.\n", "\n", - "That is search chaining drawn as a picture: search 1 fits the small map, and what it learns buys us the priors\n", - "that make the large map affordable." + "That is search chaining: search 1 fits the small model, and what it learns buys us the priors that make the\n", + "large model affordable." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb index d1295b6..b2661a9 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.ipynb @@ -440,11 +440,10 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The map is the cleanest way to see what just changed. The two `mass \u00b7 Isothermal` cards' `centre` pills have\n", - "turned grey \u2014 fixed to the measured light centres, no longer sampled \u2014 and nothing else in the figure has moved.\n", - "The footer falls from `22 unique sampled scalars` to `18`, with `67 fixed leaf slots` where there were `63`.\n", + "The two `mass \u00b7 Isothermal` centres are now fixed to the measured light centres rather than sampled, and\n", + "nothing else about the model has changed: twenty-two free parameters down to eighteen.\n", "\n", - "Four grey pills, four dimensions gone. That is the standard trick of the multi-galaxy regime, drawn." + "Four centres fixed, four dimensions gone. That is the standard trick of the multi-galaxy regime." ] }, { @@ -690,12 +689,10 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "With a third deflector the map simply grows a third card: `lens_0`, `lens_1` and `lens_2 \u00b7 Galaxy`, each an\n", - "identical copy of the structure above, each with its grey fixed mass `centre`. The footer reads `25 unique\n", - "sampled scalars` and `4 plates standing for 80 components`.\n", + "A third deflector, `lens_2`, is an identical copy of the structure above, with its own fixed mass `centre`.\n", "\n", - "Nothing about the *shape* of the model changed when we added a galaxy, which is exactly the point the list-based\n", - "API is making. The map grows by one card per deflector, and the parameter count by seven." + "Nothing about the *shape* of the model changed when we added a galaxy, which is exactly the point the\n", + "list-based API is making. The model grows by one deflector, and the parameter count by seven." ] }, { diff --git a/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb b/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb index 9dcd199..13f9f8f 100644 --- a/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb +++ b/notebooks/chapter_4_scaling_up_lensing/tutorial_4_group_scale.ipynb @@ -828,20 +828,17 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The map records the change precisely. The tied members have moved out of the `extra_galaxies` frame into one\n", - "titled `scaling_galaxies`, and they are now drawn as two separate cards, `0 \u00b7 Galaxy` and `1 \u00b7 Galaxy`, rather\n", - "than as a single plate \u2014 a plate stands for components that share one description, and these two no longer do.\n", - "On each card's `mass \u00b7 dPIEMassSph` the `sigma` pill is no longer an `independent` prior but an amber\n", - "**expression** pill, and both expressions name the same prior:\n", - "`sigma = scaling_galaxies.1.mass.sigma.sigma_ref * `, with a different ratio on each card. One\n", - "free prior, two galaxies \u2014 the scaling relation, drawn.\n", - "\n", - "The `r_cut` pills stay grey, as they were before. `r_cut_ref * luminosity_ratio ** 0.7` is arithmetic on plain\n", - "numbers rather than on a prior, so it yields a fixed value, and a fixed value is a legend entry, not a relation.\n", - "\n", - "The footer falls from `19 unique sampled scalars` to `18`. One parameter is an unremarkable saving for two\n", - "members, but the map shows why the saving keeps growing: however many cards you add to the `scaling_galaxies`\n", - "frame, every one of their `sigma` pills points back at that single `sigma_ref`." + "The tied members have moved out of `extra_galaxies` into `scaling_galaxies`, and they no longer share one\n", + "description: each member's `sigma` is no longer an independent prior but an expression,\n", + "`sigma = scaling_galaxies.1.mass.sigma.sigma_ref * `, with a different ratio for each. One\n", + "free prior, two galaxies \u2014 the scaling relation.\n", + "\n", + "`r_cut` stays fixed, as it was before. `r_cut_ref * luminosity_ratio ** 0.7` is arithmetic on plain numbers\n", + "rather than on a prior, so it yields a fixed value rather than a relation.\n", + "\n", + "Nineteen free parameters fall to eighteen. One parameter is an unremarkable saving for two members, but the\n", + "saving keeps growing: however many members you add to `scaling_galaxies`, every one of their `sigma` values\n", + "points back at that single `sigma_ref`." ] }, { diff --git a/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py b/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py index 3189a64..245f8e2 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py +++ b/scripts/chapter_2_lens_modeling/tutorial_10_prior_passing.py @@ -220,18 +220,12 @@ print(model_2.info) """ -Here is the lesson of this tutorial, drawn. Prior passing moves the **legend** and leaves the **map** alone: -almost every number in the `info` above has been replaced by a narrow prior centred on search 1's result, and -not one of those replacements shows up in the figure, because a prior is a number and numbers are not structure. - -What the map *does* show are the two changes we made deliberately, and separately from the passing itself: the -`centre` and `sersic_index` pills are white rather than grey (we chose not to pass those, so they are free -again, and the blue bracket between bulge and mass is gone with them), and the source's card is now -`bulge · Sersic` rather than `bulge · ExponentialCore` — the upgrade `take_attributes` exists to make possible. -The footer moves from `11 unique sampled scalars` to `19`. - -This is a good habit when chaining searches: draw both models. Every difference you see on the map is a -structural decision you made on purpose; everything else the chain did for you is in the legend. +Prior passing replaces almost every number in the `info` above with a narrow prior centred on search 1's result, +but it changes nothing about the model's structure, because a prior is a number and numbers are not structure. + +The two changes we made deliberately, and separately from the passing itself, are structural: `centre` and +`sersic_index` are free again, because we chose not to pass those, and the source is now a `Sersic` rather than +an `ExponentialCore` — the upgrade `take_attributes` exists to make possible. """ af.ModelPlotter(model_2).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py b/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py index 866d884..55a302e 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py +++ b/scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py @@ -361,12 +361,8 @@ print(model.info) """ -Drawing the model again makes the point sharply: the map is identical to the one above. Priors live in the -legend, not on the map, so customizing them changes many numbers in the `info` and nothing at all in the figure. - -That is exactly what you want from the two views. When you tune priors you are changing where the search looks, -not what it is looking for, and an unchanged map is the visual confirmation that you have not accidentally -changed the model itself whilst editing it. +Customizing priors changes many numbers in the `info` and nothing at all about the model itself. When you tune +priors you are changing where the search looks, not what it is looking for. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py b/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py index 129cda5..f5e80d9 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py +++ b/scripts/chapter_2_lens_modeling/tutorial_4_dealing_with_failure.py @@ -346,15 +346,11 @@ print(model.info) """ -Now the map earns its keep. On the `mass · Isothermal` card the `centre` and `ell_comps` pills are no longer -free parameters of their own: each carries a blue reference badge reading `↗ bulge.centre` and -`↗ bulge.ell_comps`, and a blue bracket runs down the side of the figure joining them to the matching -`shared ×2` badges on the `bulge · Sersic` card. That bracket *is* the light-traces-mass assumption, drawn. -The footer confirms the saving: `16 unique sampled scalars` and `4 shared priors`, down from the twenty of the -previous model. - -Pairing parameters is easy to get subtly wrong and hard to spot in a long `info` listing, but trivial to check -on the map. Whenever you pair parameters, draw the model and confirm the brackets land where you meant them to. +The `mass · Isothermal`'s `centre` and `ell_comps` are no longer free parameters of their own: each is tied to +the matching parameter of the `bulge · Sersic`. That pairing *is* the light-traces-mass assumption, and it takes +the model from twenty free parameters down to sixteen. + +Pairing parameters is easy to get subtly wrong and hard to spot in a long `info` listing. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py b/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py index a0124e8..ca39a0d 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py +++ b/scripts/chapter_2_lens_modeling/tutorial_5_linear_profiles.py @@ -444,18 +444,12 @@ print(model.info) """ -The `info` for this model is enormous — forty-five Gaussians, each with its own block of parameters. The map is -not, because it collapses repetition into **plates**. Each `bulge · Basis` card holds a `profile_list` frame -containing one dashed plate: a single `Gaussian` card badged `30 components` on the lens and `15 components` on -the source, with the index range (`0 - 29`, `0 - 14`) printed beneath the title. A plate says "this one card -stands for all of these components", and its pills describe what every member of the plate has in common: -`centre` and `ell_comps` carry blue `shared across group` badges, `sigma` reads `fixed, varies by member`, and -`intensity` is the familiar dashed `intensity · solved`. The caption under the plate repeats it in words, -`Gaussian with priors centre ⇄ shared, ell_comps ⇄ shared, sigma fixed (varies by member), intensity solved`. - -That is the whole MGE trick in one line of the figure, and the footer proves the arithmetic: `13 unique sampled -scalars` alongside `47 fixed leaf slots`, `45 parameters solved during fitting` and `2 plates standing for 45 -components`. Forty-five Gaussians, thirteen dimensions — the N=13 quoted above. +The `info` for this model is enormous — forty-five Gaussians, each with its own block of parameters — but the +model itself is small. Each `bulge · Basis` holds a single `Gaussian` repeated thirty times on the lens and +fifteen times on the source, and every member of a basis shares one `centre` and one `ell_comps`, has its own +fixed `sigma`, and has its `intensity` solved by the inversion. + +That is the whole MGE trick: forty-five Gaussians, thirteen dimensions — the N=13 quoted above. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py b/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py index da1f17b..a9201e3 100644 --- a/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py +++ b/scripts/chapter_2_lens_modeling/tutorial_9_search_chaining.py @@ -326,13 +326,12 @@ print(model_2.info) """ -The second model's map is the comparison worth making. Every grey pill has turned white — the centres and the -`sersic_index` are free again — the blue bracket between `bulge` and `mass` has gone with them, and the source's -card is now a `Sersic` carrying a `sersic_index` pill of its own. The footer reads `19 unique sampled scalars` -against the eleven of `model_1`. +The second model is the comparison worth making. The centres and the `sersic_index` are free again, the pairing +between `bulge` and `mass` has gone with them, and the source is now a `Sersic` with a `sersic_index` of its +own: nineteen free parameters against the eleven of `model_1`. -That is search chaining drawn as a picture: search 1 fits the small map, and what it learns buys us the priors -that make the large map affordable. +That is search chaining: search 1 fits the small model, and what it learns buys us the priors that make the +large model affordable. """ af.ModelPlotter(model_2).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py b/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py index 278aa1c..b74d478 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_2_multi_galaxy.py @@ -287,11 +287,10 @@ print(model.info) """ -The map is the cleanest way to see what just changed. The two `mass · Isothermal` cards' `centre` pills have -turned grey — fixed to the measured light centres, no longer sampled — and nothing else in the figure has moved. -The footer falls from `22 unique sampled scalars` to `18`, with `67 fixed leaf slots` where there were `63`. +The two `mass · Isothermal` centres are now fixed to the measured light centres rather than sampled, and +nothing else about the model has changed: twenty-two free parameters down to eighteen. -Four grey pills, four dimensions gone. That is the standard trick of the multi-galaxy regime, drawn. +Four centres fixed, four dimensions gone. That is the standard trick of the multi-galaxy regime. """ af.ModelPlotter(model).figure() @@ -460,12 +459,10 @@ print(model.info) """ -With a third deflector the map simply grows a third card: `lens_0`, `lens_1` and `lens_2 · Galaxy`, each an -identical copy of the structure above, each with its grey fixed mass `centre`. The footer reads `25 unique -sampled scalars` and `4 plates standing for 80 components`. +A third deflector, `lens_2`, is an identical copy of the structure above, with its own fixed mass `centre`. -Nothing about the *shape* of the model changed when we added a galaxy, which is exactly the point the list-based -API is making. The map grows by one card per deflector, and the parameter count by seven. +Nothing about the *shape* of the model changed when we added a galaxy, which is exactly the point the +list-based API is making. The model grows by one deflector, and the parameter count by seven. """ af.ModelPlotter(model).figure() diff --git a/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py b/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py index b747d25..168e50b 100644 --- a/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py +++ b/scripts/chapter_4_scaling_up_lensing/tutorial_4_group_scale.py @@ -565,20 +565,17 @@ print(model.info) """ -The map records the change precisely. The tied members have moved out of the `extra_galaxies` frame into one -titled `scaling_galaxies`, and they are now drawn as two separate cards, `0 · Galaxy` and `1 · Galaxy`, rather -than as a single plate — a plate stands for components that share one description, and these two no longer do. -On each card's `mass · dPIEMassSph` the `sigma` pill is no longer an `independent` prior but an amber -**expression** pill, and both expressions name the same prior: -`sigma = scaling_galaxies.1.mass.sigma.sigma_ref * `, with a different ratio on each card. One -free prior, two galaxies — the scaling relation, drawn. - -The `r_cut` pills stay grey, as they were before. `r_cut_ref * luminosity_ratio ** 0.7` is arithmetic on plain -numbers rather than on a prior, so it yields a fixed value, and a fixed value is a legend entry, not a relation. - -The footer falls from `19 unique sampled scalars` to `18`. One parameter is an unremarkable saving for two -members, but the map shows why the saving keeps growing: however many cards you add to the `scaling_galaxies` -frame, every one of their `sigma` pills points back at that single `sigma_ref`. +The tied members have moved out of `extra_galaxies` into `scaling_galaxies`, and they no longer share one +description: each member's `sigma` is no longer an independent prior but an expression, +`sigma = scaling_galaxies.1.mass.sigma.sigma_ref * `, with a different ratio for each. One +free prior, two galaxies — the scaling relation. + +`r_cut` stays fixed, as it was before. `r_cut_ref * luminosity_ratio ** 0.7` is arithmetic on plain numbers +rather than on a prior, so it yields a fixed value rather than a relation. + +Nineteen free parameters fall to eighteen. One parameter is an unremarkable saving for two members, but the +saving keeps growing: however many members you add to `scaling_galaxies`, every one of their `sigma` values +points back at that single `sigma_ref`. """ af.ModelPlotter(model).figure()