From 8a1571c83f58351418d6e49efdcea41d513168d3 Mon Sep 17 00:00:00 2001 From: ThotDjehuty Date: Sun, 8 Mar 2026 11:26:37 +0100 Subject: [PATCH] fix(lint): fix escape sequences and matplotlib colormap API in docs scripts --- docs/source/_fix_diagrams3.py | 4 ++-- docs/source/_gen_diagrams.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/source/_fix_diagrams3.py b/docs/source/_fix_diagrams3.py index 2564a77..2bf13e1 100644 --- a/docs/source/_fix_diagrams3.py +++ b/docs/source/_fix_diagrams3.py @@ -59,7 +59,7 @@ old2 = '''\ Traceback: z_4★ ← z_3★ ← z_2★ ← z_1★ via ψ ```''' -new2 = '''\ +new2 = r'''\ ```{figure} ../_static/diagrams/fig_viterbi_trellis.svg :align: center :width: 82% @@ -119,7 +119,7 @@ old4 = '''\ ↳ path-signature feature maps ```''' -new4 = '''\ +new4 = r'''\ ```{figure} ../_static/diagrams/fig_lie_group_hierarchy.svg :align: center :width: 90% diff --git a/docs/source/_gen_diagrams.py b/docs/source/_gen_diagrams.py index 5898801..9677d14 100644 --- a/docs/source/_gen_diagrams.py +++ b/docs/source/_gen_diagrams.py @@ -157,7 +157,7 @@ def fig_bm_fan(): ax.fill_between(ts, lo, hi, alpha=0.13, color=C0, label=r"$\pm 2\sqrt{t}$ (95% band)") ax.plot(ts, hi, color=C0, lw=1.2, ls="--", alpha=0.55) ax.plot(ts, lo, color=C0, lw=1.2, ls="--", alpha=0.55) - colors_cycle = plt.cm.tab10(np.linspace(0, 0.9, npaths)) + colors_cycle = plt.colormaps["tab10"](np.linspace(0, 0.9, npaths)) for i, p in enumerate(paths): ax.plot(ts, p, lw=0.9, alpha=0.75, color=colors_cycle[i]) ax.axhline(0, color=GRAY, lw=0.8, ls=":") @@ -178,7 +178,7 @@ def fig_gbm(): label=r"$\mathbb{E}[S_t] = S_0 e^{\mu t}$") ax.plot(ts, S0 * np.exp((mu - 0.5*sigma**2) * ts), color=C2, lw=1.5, ls=":", label=r"median $\approx S_0 e^{(\mu-\sigma^2/2)t}$") - colors_cycle = plt.cm.Blues(np.linspace(0.4, 0.85, 7)) + colors_cycle = plt.colormaps["Blues"](np.linspace(0.4, 0.85, 7)) for i in range(7): W = np.cumsum(rng.normal(0, np.sqrt(dt), n)) S = S0 * np.exp((mu - 0.5*sigma**2) * ts + sigma * W) @@ -846,10 +846,10 @@ def fig_lie_group_hierarchy(): nodes = { "GL": (4.5, 4.1, r"$\mathrm{GL}(n,\mathbb{R})$" + "\nall invertible $n\times n$", C0), - "SL": (1.8, 2.85, r"$\mathrm{SL}(n,\mathbb{R})$" + "\n$\det=1$", C2), + "SL": (1.8, 2.85, r"$\mathrm{SL}(n,\mathbb{R})$" + "\n" + r"$\det=1$", C2), "On": (4.5, 2.85, r"$O(n)$" + "\n$R^\top R=I$", C1), - "Sp": (7.2, 2.85, r"$\mathrm{Sp}(2n,\mathbb{R})$" + "\npreserves $\omega$", C2), - "SO": (4.5, 1.55, r"$\mathrm{SO}(n)$" + "\n$\det=+1$ (rotations)", C2), + "Sp": (7.2, 2.85, r"$\mathrm{Sp}(2n,\mathbb{R})$" + "\npreserves " + r"$\omega$", C2), + "SO": (4.5, 1.55, r"$\mathrm{SO}(n)$" + "\n" + r"$\det=+1$ (rotations)", C2), "Hn": (1.8, 1.55, r"$H(n)$ Heisenberg" + "\nupper triangular", C3), } notes = {