fix: restore lost setup scaffolding in chapter 2 tutorial_2_practicalities#14
Merged
Merged
Conversation
…ities The imports, dataset load, mask and model setup were accidentally deleted from this tutorial. Git history pinpoints the cause: the autolens_workspace commit ce1bf623 "Add __Contents__ sections to all scripts" overwrote the region spanning the old Contents list down through the __Search__ prose, collaterally removing ~119 lines of setup code. The file dropped 421 -> 302 lines there. The later HowToLens bootstrap (62a5f3a) faithfully copied the already-broken file, so the first runnable line was `search = af.Nautilus(...)` referencing undefined `dataset_name`, `dataset` and `model`. This restores the verbatim scaffolding from the last-complete version (autolens_workspace 241cc8c0): imports, __PyAutoFit__, __Initial Setup__ (with auto-simulation), __Mask__ and __Model__. The dataset is `simple__no_lens_light__mass_sis` (IsothermalSph mass + linear ExponentialCoreSph source), the same fit as tutorial_1, matching the tutorial's own prose ("the same dataset we fitted in the previous tutorial"). Modernized to current-repo conventions: setup_notebook header, `scripts/simulator/...` subprocess path, and the PyAutoLabs/PyAutoFit URL. Verified runnable end-to-end in fast mode (PYAUTO_TEST_MODE=2 + skip flags): model composes (6 free params), dataset loads, search and likelihood evaluation complete (exit 0). Scanned both HowTo repos and the source commit's deletion footprint: tutorial_2 was the only tutorial damaged this way; all other candidates were verified false positives. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/chapter_2_lens_modeling/tutorial_2_practicalities.pywas missing its imports, dataset load, mask and model setup — the first runnable line wassearch = af.Nautilus(...)referencing undefineddataset_name,dataset, andmodel, so the script could not run.Root cause (confirmed by git history)
The code was deleted by a docs commit, not never-written:
241cc8c0"Add auto-simulate snippet" (autolens_workspace)ce1bf623"Add__Contents__sections to all scripts"62a5f3abootstrap into HowToLensThe
__Contents__commit pasted a new condensed Contents block over the region spanning the old Contents list down through the__Search__prose, collaterally removing ~119 lines of setup code. The bootstrap then faithfully copied the already-broken file.Fix
Restored the verbatim scaffolding from the last-complete version (
241cc8c0):__PyAutoFit__,__Initial Setup__(with auto-simulation),__Mask__,__Model__. Dataset =simple__no_lens_light__mass_sis(IsothermalSph mass + linear ExponentialCoreSph source) — the same fit as tutorial_1, matching the tutorial's own prose ("the same dataset we fitted in the previous tutorial").Modernized to current-repo conventions:
setup_notebookheader,scripts/simulator/...subprocess path,PyAutoLabs/PyAutoFitURL. The existing body (search, analysis, VRAM, run-times, fit, results) is unchanged.Verification
Runs end-to-end in fast mode (
PYAUTO_TEST_MODE=2+ skip flags): model composes (6 free params), dataset loads (225 image-pixels after mask), search + likelihood evaluation complete, exit 0.Scan for similar damage
Scanned both HowTo repos (current state) and the source commit's deletion footprint. tutorial_2 was the only tutorial damaged this way — all other candidates verified as false positives (search-chaining
model_Nnaming; docstring code examples). HowToGalaxy's tutorial_2 is complete and unaffected.Out of scope
Pre-existing stale prose in the kept body ("7 parameters", "single Sersic model with a linear light profile") predates the breakage — left for a separate prose-cleanup pass.
🤖 Generated with Claude Code