Skip to content

Add the Measuring Mobility lecture (gap-fill for the sync that never fired) - #299

Merged
mmcky merged 1 commit into
mainfrom
recover/mobility
Aug 20, 2026
Merged

mmcky merged 1 commit into
mainfrom
recover/mobility

Conversation

@mmcky

@mmcky mmcky commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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 paths filter matches both changed files, and github.event.pull_request.merged == true held. No pull_request run was created. Not skipped, not failed, not parked awaiting approval: absent. The only sync-workflow run naming that PR is a pre-merge issue_comment run, skipped by the trust guard.

Nothing else fired for that merge commit either — the push-triggered Data URL guard has no run for d7670896 though 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 a translation-sync-failure issue; a trigger that does not fire leaves no artefact anywhere.

How it was delivered

translate init -f mobility.md at engine v0.26.0 against source d7670896, 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 current main.

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:

Gap Fix
4 mystnb figure captions untranslated localised, matching the terminology the translated prose already uses (流动性 / 五分位数 / 视界 / 度量)
9 axis labels, 1 legend label, 1 Series index untranslated localised; k left as-is, being a mathematical symbol
no i18n font block emitted, despite figures now carrying Chinese text added FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf" + plt.rcParams['font.family'], matching the form already used by 37 lectures here

One thing worth flagging for #254

init also reverted all fourteen localised _toc.yml part 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 the init path 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

  • Coverage moves this edition from 51/56 to 52/56. Still missing: bayes_intro, msy_fishery, tax_smooth (#287) and bivariate_dist (held pending the shared caption check).
  • The four captions and the axis labels are the parts most worth a native read — they were written by hand rather than generated.

…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>
Copilot AI lite review requested due to automatic review settings August 20, 2026 01:59
@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for playful-platypus-17d3bb ready!

Name Link
🔨 Latest commit 5935d59
🔍 Latest deploy log https://app.netlify.com/projects/playful-platypus-17d3bb/deploys/6a865f76c92e6a0008260c0b
😎 Deploy Preview https://deploy-preview-299--playful-platypus-17d3bb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mobility to lectures/_toc.yml so it appears in the built book.
  • Extend lectures/_static/quant-econ.bib with 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 thread lectures/mobility.md
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 thread lectures/mobility.md
Comment on lines +516 to +519
def mfp_measure(M):
N = len(M)
ψ = np.ones(N) / N
return N / (ψ @ mean_first_passage(M) @ ψ)
Comment thread lectures/mobility.md
对于第 1 部分,我们从每个起始状态模拟长路径,并记录首次命中时间。

```{code-cell} ipython3
def mfp_simulated(M, num_paths=2_000, path_length=400, seed=1234):
@github-actions

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants