Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/scripts/check_tutorials_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
section marker (``__Wrap Up__`` or ``__Summary__``). A truncated script never
reaches its wrap-up, so the absence of the marker is a reliable signal that the
script lost content. Deliberate "not written yet" stub tutorials still carry a
``__Wrap Up__`` section, so they pass.
``__Wrap Up__`` section, so they pass. Tutorial 6 of Chapter 1 deliberately
ends with ``__Likelihood Function__``; it must retain its closing Chapter 2
transition in the final docstring.

A second, cheaper guard flags any script whose final docstring block ends on a
colon (``:``) — the classic "a plot/code block follows" promise left dangling
Expand Down Expand Up @@ -46,9 +48,17 @@ def final_docstring(text: str) -> str | None:
def check(path: Path) -> str | None:
"""Return a failure reason for a truncated-looking tutorial, else None."""
text = path.read_text(encoding="utf-8")
if not any(marker in text.lower() for marker in TERMINAL_MARKERS):
return "no __Wrap Up__/__Summary__ terminal section (looks truncated)"
trailing = final_docstring(text)
likelihood_ending = (
path.parts[-2:] == ("chapter_1_introduction", "tutorial_6_fitting.py")
and "__Likelihood Function__" in text
and trailing is not None
and "__Likelihood Function__" not in trailing
and "In Chapter 2," in trailing
and trailing.strip().endswith("systematically.")
)
if not likelihood_ending and not any(marker in text.lower() for marker in TERMINAL_MARKERS):
return "no __Wrap Up__/__Summary__ terminal section (looks truncated)"
if trailing is not None and trailing.strip().endswith(":"):
return "final docstring ends on ':' (dangling promise of a following block)"
return None
Expand All @@ -67,7 +77,8 @@ def main(root: str) -> int:
print(f" [FAIL] {f.relative_to(root)} — {reason}")
print(
"\nEach tutorial must end with a `__Wrap Up__` (or `__Summary__`) "
"section. If a script is genuinely truncated, restore its lost "
"section (or the approved Chapter 1 likelihood ending). "
"If a script is genuinely truncated, restore its lost "
"content; if it is complete, add the terminal section."
)
return 1
Expand Down
10 changes: 5 additions & 5 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ AUTO-GENERATED by PyAutoHands — do not edit by hand; regenerate with generate.
- Contents: Initial Setup, Concise Code, Cosmological Distances, Convergence, Deflection Angles, The Lensing Potential, Shear and Magnification, Critical Curves and Caustics, Einstein Radius, Time Delays, Wrap Up, Env
- [Tutorial 4: Point Sources](scripts/chapter_1_introduction/tutorial_4_point_sources.py): In the previous tutorials, we lensed extended galaxies, producing arcs and Einstein rings. We now turn to sources whose individual lensed images are too small for a telescope to resolve: **point sources**.
- Contents: Initial Setup, Seeing the Compact Source, Point Sources, Point Source Tracer, The Lens Equation, Point Solver, Finding the Images, Multiple Images and Critical Curves, Magnifications, Interpreting Fluxes, Time Delays, Connecting Time Delays to the Images, Extended Versus Point Computations, Wrap Up
- [Tutorial 5: Data](scripts/chapter_1_introduction/tutorial_5_data.py): In the last tutorials, we use tracers to create images of strong lenses. However, those images don't accurately represent what we would observe through a telescope.
- Contents: Initial Setup, Optics Blurring, Poisson Noise, Background Sky, Simulator, Output, Point Source Data, Interferometer Data, Weak Lensing Data, Wrap Up
- [Tutorial 6: Fitting](scripts/chapter_1_introduction/tutorial_6_fitting.py): In previous tutorials, we used light profiles to create simulated images of a tracer and visualized how these images would appear when captured by a CCD detector on a telescope like the Hubble Space Telescope.
- Contents: Dataset, Dataset Auto-Simulation, Mask, Masked Grid, Fitting, Incorrect Fit, Model Fitting, Wrap Up
- [Tutorial 7: Summary](scripts/chapter_1_introduction/tutorial_7_summary.py): In this chapter, we have learnt that:
- [Tutorial 5: Data](scripts/chapter_1_introduction/tutorial_5_data.py): In the previous tutorials, we used tracers to create images of strong lenses. We will now use one of these images to simulate an observation through a telescope.
- Contents: Initial Setup, Optics Blurring, Poisson Noise, Background Sky, Simulator, Output, Point Source Data, Interferometer Data, Weak Lensing Data, Group and Cluster Lenses, Wrap Up
- [Tutorial 6: Fitting](scripts/chapter_1_introduction/tutorial_6_fitting.py): In the previous tutorial, we chose a lens and source, predicted their lensed image and simulated a telescope observation. We will now work in the other direction: starting with an image, we want to learn about the objects that produced it.
- Contents: Dataset, Dataset Auto-Simulation, Mask, Masked Grid, Fitting, Incorrect Fit, Model Fitting, Likelihood Function
- [Tutorial 7: Summary](scripts/chapter_1_introduction/tutorial_7_summary.py): In this chapter, we have built up the steps needed to describe a gravitational lens and compare its predicted image with an observation:
- Contents: Start, Object Composition, Visualization, Code Design, Source Code, Wrap Up

## chapter_2_lens_modeling
Expand Down
Loading
Loading