Add the Measuring Mobility lecture (gap-fill for the sync that never fired) - #299
Merged
Merged
Conversation
…fired) lecture-python-intro#839 merged mobility.md on 2026-08-19 and no pull_request sync run was created for that merge — not skipped, not failed, not parked: absent, with every trigger condition satisfied. The lecture was undelivered with no artefact anywhere recording it. Delivered by `translate init -f mobility.md` at engine v0.26.0 against source d7670896, rather than by \translate-resync. Per the 2026-08-20 ruling on QuantEcon/action-translation#276 the CLI is now the documented recovery route: it reads source off the local filesystem, so it cannot carry the stale merge-time snapshot, and its parity check is anchored to current main. Structural parity verified against source: 77/77 directives, 48/48 code cells, 23/23 headings, and all 16 citations resolve. Two localisation gaps in the generated output were fixed by hand, both of them values byte-identical to the English source and so instances of the classes tracked in QuantEcon/action-translation#254 and #255: - four mystnb figure captions shipped untranslated - nine matplotlib axis labels, one legend label and one Series index shipped untranslated, and no i18n font block was emitted The font block matches the convention already used by 37 lectures in this edition. `k` is left as-is, being a mathematical symbol. Note `init` also copied 52 non-markdown files and reverted all fourteen localised _toc.yml part captions to English — the QuantEcon/action-translation#254 class, reproduced exactly. Those were reverted; the ToC carries only the new `- file: mobility` entry and the bibliography addition, which is purely additive and brings the target bib into step with source at 316 keys. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for playful-platypus-17d3bb ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR gap-fills the missing “Measuring Mobility” lecture by adding the translated mobility.md, wiring it into the book ToC, and extending the shared bibliography/state metadata so the lecture builds and cites correctly.
Changes:
- Add new lecture
lectures/mobility.md(Chinese translation + figures/code). - Add
mobilitytolectures/_toc.ymlso it appears in the built book. - Extend
lectures/_static/quant-econ.bibwith required citation keys and add translation engine state in.translate/state/mobility.md.yml.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lectures/mobility.md | New “Measuring Mobility” lecture content, including code, figures, and exercises/solutions |
| lectures/_toc.yml | Adds the new lecture to the ToC |
| lectures/_static/quant-econ.bib | Adds bibliography entries needed by the new lecture (and parity with source) |
| .translate/state/mobility.md.yml | Records source SHA and translation tool metadata for mobility.md |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+541
to
+547
| def mobility_measures(M): | ||
| "Return the four mobility measures for stochastic matrix M." | ||
| return pd.Series({'μ_S': shorrocks(M), | ||
| 'μ_B': bartholomew(M), | ||
| 'μ_NB': bartholomew_normalized(M), | ||
| 'μ_2E': second_eigenvalue(M), | ||
| 'μ_MFP': mfp_measure(M)}) |
Comment on lines
+516
to
+519
| def mfp_measure(M): | ||
| N = len(M) | ||
| ψ = np.ones(N) / N | ||
| return N / (ψ @ mean_first_passage(M) @ ψ) |
| 对于第 1 部分,我们从每个起始状态模拟长路径,并记录首次命中时间。 | ||
|
|
||
| ```{code-cell} ipython3 | ||
| def mfp_simulated(M, num_paths=2_000, path_length=400, seed=1234): |
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.
Delivers
mobility.md("Measuring Mobility"), which has been missing from this edition since 2026-08-19.Why it was missing
lecture-python-intro#839 merged the lecture at 19:09:02Z with every trigger condition for the sync workflow satisfied — the workflow is active, its
pathsfilter matches both changed files, andgithub.event.pull_request.merged == trueheld. Nopull_requestrun was created. Not skipped, not failed, not parked awaiting approval: absent. The only sync-workflow run naming that PR is a pre-mergeissue_commentrun, skipped by the trust guard.Nothing else fired for that merge commit either — the push-triggered
Data URL guardhas no run ford7670896though it ran for the analogous #837 two days earlier — so it reads as an Actions dispatch gap rather than a workflow-condition bug. That class is worse than a sync failure, which at least files atranslation-sync-failureissue; a trigger that does not fire leaves no artefact anywhere.How it was delivered
translate init -f mobility.mdat engine v0.26.0 against sourced7670896, not\translate-resync. Per the 2026-08-20 ruling on action-translation#276 the CLI is now the documented recovery route: it reads the source document off the local filesystem, so it cannot carry a stale merge-time snapshot, and its parity check is anchored to currentmain.Verified against source: 77/77 directives, 48/48 code cells, 23/23 headings, all 16
{cite}keys resolve, and the bibliography addition is purely additive (target bib now matches source at 316 keys).Hand fixes applied to the generated output
Two localisation gaps came through, both values byte-identical to the English source — instances of the classes tracked in action-translation#254 and #255:
kleft as-is, being a mathematical symbolFONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"+plt.rcParams['font.family'], matching the form already used by 37 lectures hereOne thing worth flagging for #254
initalso reverted all fourteen localised_toc.ymlpart captions to English (导言→Introduction, 经济数据→Economic Data, …) and copied 52 non-markdown files, including four- file:entries for lectures this edition does not have. That is the #254 class reproduced exactly, on theinitpath rather than the sync path.All of it was reverted. The ToC in this PR carries one added line —
- file: mobility— and the fourteen Chinese captions are untouched.Review notes
bayes_intro,msy_fishery,tax_smooth(#287) andbivariate_dist(held pending the shared caption check).