Skip to content

Commit 8ba11b3

Browse files
committed
update
1 parent 5d239ed commit 8ba11b3

5 files changed

Lines changed: 54 additions & 12 deletions

File tree

‎_quarto-book.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ format:
5151
# is the single source of truth. Flexibility knobs:
5252
# number-sections: false -> turn numbering off entirely
5353
# number-depth: 2 -> only number to e.g. 1.2 (not 1.2.8)
54+
# Depth stays at 3 book-wide: several notebooks put an h4 directly under an
55+
# h2, which at depth 4 renders a bogus zero component (e.g. "10.3.0.1"). A
56+
# chapter that wants numbered h4s opts in via a per-directory _metadata.yml
57+
# (see notebooks/Notebook_1/_metadata.yml).
5458
number-sections: true
5559
number-depth: 3
5660
execute:

‎notebooks/Notebook_1/Notebook_1a_Overview_and_Data_Representation.ipynb‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
"id": "9D4gLiC3Q7DR"
269269
},
270270
"source": [
271-
"# From Ideas to Code: Why Python?\n",
271+
"## From Ideas to Code: Why Python?\n",
272272
"\n",
273273
"Once we define a learning problem, we need to work with the data directly.\n",
274274
"\n",
@@ -3147,7 +3147,19 @@
31473147
"id": "294d8739",
31483148
"metadata": {},
31493149
"source": [
3150-
"### Example 1: The Identity Matrix\n",
3150+
"### Examples\n",
3151+
"\n",
3152+
"Five matrices, from the one that does nothing to one that does everything at once.\n",
3153+
"For each, watch both panels: the flow field tells you *where* space moves, the morphing\n",
3154+
"grid tells you *how* the whole plane is reshaped."
3155+
]
3156+
},
3157+
{
3158+
"cell_type": "markdown",
3159+
"id": "4e4b6e45",
3160+
"metadata": {},
3161+
"source": [
3162+
"#### Example 1: The Identity Matrix\n",
31513163
"\n",
31523164
"The identity matrix leaves every vector unchanged.\n",
31533165
"\n",
@@ -3201,7 +3213,7 @@
32013213
"id": "19537899",
32023214
"metadata": {},
32033215
"source": [
3204-
"### Example 2: Stretching Space\n",
3216+
"#### Example 2: Stretching Space\n",
32053217
"\n",
32063218
"This matrix stretches the first coordinate and slightly shrinks the second coordinate.\n",
32073219
"\n",
@@ -3255,7 +3267,7 @@
32553267
"id": "3821e02a",
32563268
"metadata": {},
32573269
"source": [
3258-
"### Example 3: Rotating Space\n",
3270+
"#### Example 3: Rotating Space\n",
32593271
"\n",
32603272
"A rotation matrix turns every point by the same angle.\n",
32613273
"\n",
@@ -3311,7 +3323,7 @@
33113323
"id": "483df675",
33123324
"metadata": {},
33133325
"source": [
3314-
"### Example 4: Mixing Features with a Shear\n",
3326+
"#### Example 4: Mixing Features with a Shear\n",
33153327
"\n",
33163328
"This matrix mixes the two coordinates.\n",
33173329
"\n",
@@ -3365,7 +3377,7 @@
33653377
"id": "efef5b10",
33663378
"metadata": {},
33673379
"source": [
3368-
"### Example 5: A General Transformation\n",
3380+
"#### Example 5: A General Transformation\n",
33693381
"\n",
33703382
"Now try a matrix that stretches, rotates, and mixes coordinates all at once.\n",
33713383
"\n",

‎notebooks/Notebook_1/Notebook_1a_Overview_and_Data_Representation.py‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
# > Who or what might be missing from the data?
183183

184184
# %% [markdown] id="9D4gLiC3Q7DR"
185-
# # From Ideas to Code: Why Python?
185+
# ## From Ideas to Code: Why Python?
186186
#
187187
# Once we define a learning problem, we need to work with the data directly.
188188
#
@@ -1395,7 +1395,14 @@ def plot_matrix_flow_and_morph_gif(
13951395

13961396

13971397
# %% [markdown]
1398-
# ### Example 1: The Identity Matrix
1398+
# ### Examples
1399+
#
1400+
# Five matrices, from the one that does nothing to one that does everything at once.
1401+
# For each, watch both panels: the flow field tells you *where* space moves, the morphing
1402+
# grid tells you *how* the whole plane is reshaped.
1403+
1404+
# %% [markdown]
1405+
# #### Example 1: The Identity Matrix
13991406
#
14001407
# The identity matrix leaves every vector unchanged.
14011408
#
@@ -1417,7 +1424,7 @@ def plot_matrix_flow_and_morph_gif(
14171424
)
14181425

14191426
# %% [markdown]
1420-
# ### Example 2: Stretching Space
1427+
# #### Example 2: Stretching Space
14211428
#
14221429
# This matrix stretches the first coordinate and slightly shrinks the second coordinate.
14231430
#
@@ -1439,7 +1446,7 @@ def plot_matrix_flow_and_morph_gif(
14391446
)
14401447

14411448
# %% [markdown]
1442-
# ### Example 3: Rotating Space
1449+
# #### Example 3: Rotating Space
14431450
#
14441451
# A rotation matrix turns every point by the same angle.
14451452
#
@@ -1463,7 +1470,7 @@ def plot_matrix_flow_and_morph_gif(
14631470
)
14641471

14651472
# %% [markdown]
1466-
# ### Example 4: Mixing Features with a Shear
1473+
# #### Example 4: Mixing Features with a Shear
14671474
#
14681475
# This matrix mixes the two coordinates.
14691476
#
@@ -1485,7 +1492,7 @@ def plot_matrix_flow_and_morph_gif(
14851492
)
14861493

14871494
# %% [markdown]
1488-
# ### Example 5: A General Transformation
1495+
# #### Example 5: A General Transformation
14891496
#
14901497
# Now try a matrix that stretches, rotates, and mixes coordinates all at once.
14911498
#

‎notebooks/Notebook_1/_metadata.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Per-directory Quarto metadata: applies to every notebook in this folder and
2+
# overrides the book-wide settings in _quarto-book.yml.
3+
#
4+
# Module 1 groups its matrix-transformation examples one level deeper (1.8.6
5+
# "Examples" -> 1.8.6.1 "Example 1: ..."), so it needs 4th-level headings
6+
# numbered. The book default stays at 3 because other notebooks put an h4
7+
# directly under an h2, which at depth 4 renders a bogus zero component
8+
# (e.g. "10.3.0.1").
9+
format:
10+
html:
11+
number-depth: 4

‎scripts/render_book.sh‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ while IFS= read -r nb; do
3535
cp "$nb" "$BUILD/$rel"
3636
done < <(find "$ROOT/notebooks" -name '*.ipynb')
3737

38+
# Per-directory metadata (_metadata.yml) overrides the book-wide config for the
39+
# notebooks in that folder, so it has to be staged alongside them.
40+
while IFS= read -r meta; do
41+
rel="${meta#"$ROOT"/}"
42+
mkdir -p "$BUILD/$(dirname "$rel")"
43+
cp "$meta" "$BUILD/$rel"
44+
done < <(find "$ROOT/notebooks" -name '_metadata.yml')
45+
3846
# Render the book.
3947
( cd "$BUILD" && "$QUARTO" render ) || { echo "render failed"; exit 1; }
4048

0 commit comments

Comments
 (0)