Skip to content

Draw the model figure beside every model.info, and the EP state figure (PyAutoFit#1620) - #52

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/model-figures-rollout-autofit
Sep 13, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/model-figures-rollout-autofit

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Phase 6a of the model-figures rollout (PyAutoLabs/PyAutoFit#1620): every tutorial that prints a model's info now draws af.ModelPlotter(model).figure() beside it and teaches the reading: the figure is the map (structure, ownership, what is fixed, shared, related or asserted) and info is the legend (priors and values). Tutorial 1 introduces the idea in full; later tutorials say what to look for in each figure. Tutorial 4's five-Gaussian model is where the plate appears (5 components, independent badges), and its tuned-priors variant renders identically to the free one, which is the "map unchanged, legend moved" point made in prose.

Tutorial 5 (expectation propagation) refreshes the EP state figure every sweep (visualise_interval=1) and, after the fit, draws af.EPPlotter(kind="state") from the result's swept factor graph, reading factor status, update age and confirmed reverted updates. Its prose was written against a real render of the run. config/output.yaml gains the model_figure key (off, matching autofit_workspace) so the output-folder pointers to graph_model.png / graph_state.png are true.

Tutorials 3.2 and 3.4 already carried figures (phase 4). tutorial_optional_hierarchical_ep.py is untouched: its fit is commented out by design.

Opened under Heart RED release validation FAILED (stage integrate) (unrelated autolens integrate scripts) with explicit human authorisation on 2026-09-13; merge stays human via /prm, after the upstream library PR.

Scripts Changed

  • scripts/chapter_1_introduction/tutorial_1_models.py — 4 figures; the map/legend teaching block at the first site (file is CRLF; line endings preserved)
  • scripts/chapter_1_introduction/tutorial_3_non_linear_search.py — 1 figure
  • scripts/chapter_1_introduction/tutorial_4_why_modeling_is_hard.py — 4 figures; plate and "map unchanged" prose verified against rendered PNGs
  • scripts/chapter_1_introduction/tutorial_7_the_details.py — 1 figure
  • scripts/chapter_1_introduction/tutorial_optional_bayesian_formalism.py — 1 figure
  • scripts/chapter_3_graphical_models/tutorial_3_graphical_benefits.py — 1 figure on global_prior_model
  • scripts/chapter_3_graphical_models/tutorial_5_expectation_propagation.py — 1 figure on global_prior_model, visualise_interval=1, __Seeing the EP run__ block with the EP state figure, output bullets for the two PNGs
  • config/output.yaml — model_figure: false added with the same comment as autofit_workspace
  • notebooks/** — the seven twins regenerated via PyAutoHands generate.py howtofit; catalogue byte-identical; tutorial_8_scientific_workflow.ipynb still has zero code cells

Upstream PR

PyAutoLabs/PyAutoFit#1621 — EPResult.factor_graph, consumed by tutorial 5. Smoke CI checks out the same-named library branch; merge library first.

Test Plan

  • Every touched tutorial runs headless under the smoke env profile from the repo root, exit 0, no traceback
  • .github/scripts/run_smoke.py: 18/18 PASS locally. Tutorial 5 is excluded from CI by config/build/no_run.yaml (NEEDS_FIX, PyAutoFit#1454), so its manual headless run (exit 0, EP state figure rendered) is the evidence for that script
  • Coverage check: 13/13 bare model prints have a .figure( call within the following lines; navigator check exits 0
  • Smoke tests pass (CI)

Known, pre-existing and out of scope (to be filed as its own prompt): tutorial 5 creates centre_shared_prior but never assigns it, so despite the prose no centre is actually shared across the datasets; the new figure prose describes only what the map shows.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DLx38vS6F1M7K5LnpVbeZ7

Phase 6a of the model-figures rollout: each tutorial that prints a
model's info now draws af.ModelPlotter(model).figure() beside it and
teaches the map (structure) vs legend (priors) reading. Tutorial 5
refreshes the EP state figure every sweep (visualise_interval=1) and
shows af.EPPlotter(kind="state") from the result's swept factor graph
(PyAutoFit EPResult.factor_graph, same branch). config/output.yaml
gains the model_figure key (off). Notebooks and catalogue regenerated.

Refs PyAutoLabs/PyAutoFit#1620

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLx38vS6F1M7K5LnpVbeZ7
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 13, 2026
@Jammy2211
Jammy2211 merged commit 70bfcfa into main Sep 13, 2026
7 checks passed
@Jammy2211
Jammy2211 deleted the feature/model-figures-rollout-autofit branch September 13, 2026 11:36
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant