From 9aa173c9e8a6247a202990df20fbf77c5b815013 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 18 Aug 2026 12:10:23 +0000 Subject: [PATCH] Add the missing setup_notebook() line to HowToGalaxy tutorial scripts Every workspace/tutorial script opens with # from autogalaxy import setup_notebook; setup_notebook() right after the module docstring; the line chdir's to the workspace root and enables inline plotting when the generated notebook is run. A handful of scripts never got it. Without it a tutorial that loads data by a relative path (or shells out to a simulator) fails under nbconvert, which runs with CWD set to the notebook's own directory, and works interactively only if the user happened to launch jupyter from the repo root. This is the full audit of every chapter in the repo (plus the root start_here.py): the missing line is added in the sibling convention's exact position and the generated notebooks are updated to match, uncommented, the way PyAutoHands emits them. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0126SmBwHMzP4okcjhjPoLFZ --- .../chapter_2_modeling/tutorial_8_need_for_speed.ipynb | 10 ++++++++++ .../chapter_2_modeling/tutorial_8_need_for_speed.py | 2 ++ start_here.ipynb | 2 ++ start_here.py | 2 ++ 4 files changed, 16 insertions(+) diff --git a/notebooks/chapter_2_modeling/tutorial_8_need_for_speed.ipynb b/notebooks/chapter_2_modeling/tutorial_8_need_for_speed.ipynb index 600140a..39008ad 100644 --- a/notebooks/chapter_2_modeling/tutorial_8_need_for_speed.ipynb +++ b/notebooks/chapter_2_modeling/tutorial_8_need_for_speed.ipynb @@ -204,6 +204,16 @@ "\n", "_setup_colab.setup(\"howtogalaxy\")" ] + }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "\n", + "from autogalaxy import setup_notebook; setup_notebook()" + ], + "outputs": [], + "execution_count": null } ], "metadata": { diff --git a/scripts/chapter_2_modeling/tutorial_8_need_for_speed.py b/scripts/chapter_2_modeling/tutorial_8_need_for_speed.py index 36ea7a4..753f8f4 100755 --- a/scripts/chapter_2_modeling/tutorial_8_need_for_speed.py +++ b/scripts/chapter_2_modeling/tutorial_8_need_for_speed.py @@ -161,3 +161,5 @@ passing (tutorial 10) reduce the number of evaluations needed to fit complex models, laying the groundwork for the pixelized reconstructions of chapter 3. """ + +# from autogalaxy import setup_notebook; setup_notebook() diff --git a/start_here.ipynb b/start_here.ipynb index 7a2e504..4d026c5 100644 --- a/start_here.ipynb +++ b/start_here.ipynb @@ -97,6 +97,8 @@ "cell_type": "code", "metadata": {}, "source": [ + "\n", + "from autogalaxy import setup_notebook; setup_notebook()\n", "\n", "print(__doc__)\n" ], diff --git a/start_here.py b/start_here.py index 89b4376..8689ce7 100644 --- a/start_here.py +++ b/start_here.py @@ -50,4 +50,6 @@ Open `scripts/chapter_1_introduction/tutorial_0_visualization.py` (or the `.ipynb` equivalent) and start there. """ +# from autogalaxy import setup_notebook; setup_notebook() + print(__doc__)