From 0f7d6ccd71cff036d647de0a2334b88f1a050ed6 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 20 Jul 2026 10:43:15 +1000 Subject: [PATCH] FIX: execution and doc failures from the Anaconda 2026.07 cache build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves the four failures reported in #182. All four are target-side defects; the English source is healthy in every case. likelihood_bayes — the font block called `mpl.font_manager.fontManager` and `plt.rcParams` before `import matplotlib.pyplot as plt`. Newer matplotlib no longer imports `font_manager` as a side effect of `import matplotlib`, so this raised AttributeError (and would have raised NameError on `plt`). Moved the pyplot import above both uses. An audit of the font block across all 69 lectures found this the only file with either ordering hazard. kalman_2 — a `.text()` annotation drew the covariance matrix with `\begin{bmatrix}`, which matplotlib mathtext cannot render (it supports no LaTeX environments). Rewritten as `\left[ \substack{...} \right]`, which renders an equivalent bracketed 2x2 matrix under mathtext, using `\;` as the column separator rather than `&`. This keeps the drop-usetex standard from #22 intact with no loss of information. The lecture's other `\begin{bmatrix}` uses are inside `{math}` blocks, rendered by MathJax, and are unaffected. sir_model — the header directive had lost its argument: `{raw}` instead of `{raw} jupyter`. The other 50 lectures carrying this directive kept theirs. ak_aiyagari — the file carried a stray fence at line 38 followed by a duplicated copy of the original frontmatter, and a doubled closing fence at EOF. The stray opener ran to line 56, swallowing both the H1 title and the `_admonition/gpu.md` include, which is what produced the 13 "headings start at H2" warnings. Removed both strays; the file's fence structure now matches the English source exactly (122). The `translation.title` field was also corrupt ("V, σ, μ") and has been set to the lecture title. An edition-wide sweep found no other file with unbalanced fences. The last two are content corruption introduced in translation and warrant engine issues against action-translation; they are not covered by the existing #107/#115/#116/#117 set. Co-Authored-By: Claude Opus 4.8 (1M context) --- lectures/ak_aiyagari.md | 18 +----------------- lectures/kalman_2.md | 4 ++-- lectures/likelihood_bayes.md | 2 +- lectures/sir_model.md | 2 +- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/lectures/ak_aiyagari.md b/lectures/ak_aiyagari.md index 15dbf88..fc246e9 100644 --- a/lectures/ak_aiyagari.md +++ b/lectures/ak_aiyagari.md @@ -10,7 +10,7 @@ kernelspec: language: python name: python3 translation: - title: V, σ, μ + title: 长寿、异质性个体、世代交叠模型 headings: Overview: 概述 Environment: 经济环境 @@ -35,21 +35,6 @@ translation: 'Experiment 2: Preannounced tax cut': 实验2:预先宣布的减税 --- -``` ---- -jupytext: - text_representation: - extension: .md - format_name: myst - format_version: 0.13 - jupytext_version: 1.17.3 -kernelspec: - display_name: Python 3 (ipykernel) - language: python - name: python3 ---- - - # 长寿、异质性个体、世代交叠模型 ```{include} _admonition/gpu.md @@ -1477,4 +1462,3 @@ ax2.set_ylabel(r"j") plt.show() ``` -``` diff --git a/lectures/kalman_2.md b/lectures/kalman_2.md index ea01799..bdbf164 100644 --- a/lectures/kalman_2.md +++ b/lectures/kalman_2.md @@ -352,8 +352,8 @@ for i, t in enumerate(np.linspace(0, T-1, 3, dtype=int)): axs[i].set_ylabel(r'$u_{{{}}}$'.format(str(t))) cov_latex = ( - r'$\Sigma_{{{}}}= \begin{{bmatrix}} {:.2f} & {:.2f} \\ ' - r'{:.2f} & {:.2f} \end{{bmatrix}}$' + r'$\Sigma_{{{}}}= \left[ \substack{{{:.2f} \; {:.2f} \\ ' + r'{:.2f} \; {:.2f}}} \right]$' ).format(t, cov[0, 0], cov[0, 1], cov[1, 0], cov[1, 1]) axs[i].text(0.33, -0.15, cov_latex, transform=axs[i].transAxes) diff --git a/lectures/likelihood_bayes.md b/lectures/likelihood_bayes.md index 1400176..bcaffe5 100644 --- a/lectures/likelihood_bayes.md +++ b/lectures/likelihood_bayes.md @@ -62,10 +62,10 @@ translation: FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf" import matplotlib as mpl +import matplotlib.pyplot as plt mpl.font_manager.fontManager.addfont(FONTPATH) plt.rcParams['font.family'] = ['Source Han Serif SC'] -import matplotlib.pyplot as plt import numpy as np from numba import vectorize, jit, prange from math import gamma diff --git a/lectures/sir_model.md b/lectures/sir_model.md index 1f0daa7..6898ad8 100644 --- a/lectures/sir_model.md +++ b/lectures/sir_model.md @@ -21,7 +21,7 @@ translation: Ending Lockdown: 解除封锁 --- -```{raw} +```{raw} jupyter