Fig. 1A icons: committed SVGs rasterised at build time; CDN PNGs removed

The two Flaticon icons (licensed via GG's paid subscription) are now committed
as SVG source and rasterised at 2048 px by make_figs.py via rsvg-convert
(~6000 DPI at the placed size - print-lossless), keeping every figure a pure
function of the script plus committed sources. The 512 px CDN PNGs are gone;
a clear error names the librsvg dependency if rsvg-convert is missing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BkRLcc18rwT2Lysu6PbG7v
This commit is contained in:
Giorgio Gilestro 2026-09-07 13:27:25 +01:00
parent 9055fca792
commit c9c4d927ad
7 changed files with 29 additions and 7 deletions

View file

@ -42,21 +42,41 @@ def save(fig, name):
print("wrote", OUT / f"{name}.pdf")
def _icon(svg_name: str):
"""Rasterise a committed icon SVG at 2048 px (print-lossless at the ~0.3 in placed size).
Requires ``rsvg-convert`` (librsvg). The SVGs are the committed source of truth; no derived
PNGs are kept in the repo.
"""
import subprocess
import tempfile
svg = OUT / "icons" / svg_name
with tempfile.NamedTemporaryFile(suffix=".png") as f:
try:
subprocess.run(["rsvg-convert", "-w", "2048", "-h", "2048", "-o", f.name, str(svg)],
check=True, capture_output=True)
except FileNotFoundError as e:
raise RuntimeError("rsvg-convert (librsvg) is required to rasterise the icon SVGs "
"for fig1a") from e
return plt.imread(f.name)
# ---------------------------------------------------------------- fig 1: experimental programme
def fig1a():
from matplotlib.patches import FancyBboxPatch
# (name, architecture, guarantee, edge, cell face, header fill, header text colour, icon)
# Icons: Flaticon #2347052 (green pea, for Mendel) and #10479785 (robot), used under GG's
# paid Flaticon licence.
# Icons: Flaticon #2347052 (green pea, for Mendel) and #10479785 (robot) as committed SVGs,
# used under GG's paid Flaticon licence; rasterised at build time by _icon().
TIERS = [
("Biological model", "Wright\u2013Fisher simulator (NumPy)", "closed forms \u00b7 bitwise-reproducible",
"#4e8d4e", "#eef6ec", "#c5e0bd", "#2d5b2d", "icons/pea.png"),
"#4e8d4e", "#eef6ec", "#c5e0bd", "#2d5b2d", "pea.svg"),
("Trained networks", "RNN \u00b7 MLP \u00b7 VAE on a synthetic oracle;\nconvolutional VAE on MNIST",
"sign-level tests \u00b7 exact oracles", "#5b9bc9", "#eff6fb", "#c9e2f2", "#1f4e79",
"icons/robot.png"),
"robot.svg"),
("Language models", "LoRA specialists on Qwen 0.5B & 7B;\nexact-match verifier",
"seed-replicated signs", "#3c6ea5", "#e7eef8", "#adc8e8", "#1d3f66", "icons/robot.png"),
"seed-replicated signs", "#3c6ea5", "#e7eef8", "#adc8e8", "#1d3f66", "robot.svg"),
]
ROWS = [
("Grounding = immigration",
@ -115,8 +135,8 @@ def fig1a():
linespacing=1.3, color=textcol)
ax.text(xc, 0.833, guarantee, ha="center", va="bottom", fontsize=6.4,
style="italic", color=textcol, alpha=0.85)
img = plt.imread(str(OUT / icon))
ax.add_artist(AnnotationBbox(OffsetImage(img, zoom=0.055),
img = _icon(icon)
ax.add_artist(AnnotationBbox(OffsetImage(img, zoom=28.0 / img.shape[0]),
(x + cw - gap - 0.024, 0.902), frameon=False))
for i2, (label, definition, cells) in enumerate(ROWS):