Paths of all riders: one Google Sheet layer, deaths as line styles; silhouettes with their interior lines
CI / test (pull_request) Successful in 44s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-18 22:26:51 -05:00
co-authored by Claude Opus 5.5
parent 7ef8a58a0e
commit 57839fcc87
5 changed files with 92 additions and 65 deletions
+18 -21
View File
@@ -468,30 +468,27 @@ def deliberate(r):
def path_layers(runs):
"""'Show the paths of all riders' on the valley map: for every layer in measures.yaml path_layers, how many runs
went from each place to the next (like valley()), plus where the death layers' runs ended. Every source is used
here, not only the statistics' sources. Sources that record no route are counted only (path_unrouted)."""
cfg = M["path_layers"]
routed = sorted({s for layer in cfg for s in layer.get("sources", [])})
"""'Show the paths of all riders' on the valley map: for every layer in measures.yaml path_layers (one source or
more), how many runs went from each place to the next (like valley()), split by how the runs ended: `lived` (did
not die), `chose` (a deliberate death) and `failed` (every other death), plus where the deaths happened. Every
source is used here, not only the statistics' sources. Sources that record no route are counted only."""
out = []
for layer in cfg:
if "death" in layer:
sel = [r for r in runs if r["source"] in routed and r["outcome"] in DEATHS
and deliberate(r) == (layer["death"] == "deliberate")]
else:
sel = [r for r in runs if r["source"] in layer["sources"]
and (not layer.get("entry") or r.get("entry") in layer["entry"])
and (not layer.get("entry_not") or r.get("entry") not in layer["entry_not"])]
v = valley(sel)
item = {"key": layer["key"], "label": layer["label"], "runs": len(sel), "edges": v["edges"]}
if "death" in layer:
ends = {}
for r in sel:
for layer in M["path_layers"]:
sel = [r for r in runs if r["source"] in layer["sources"]]
kinds = {"lived": [], "chose": [], "failed": []}
for r in sel:
kinds["lived" if r["outcome"] not in DEATHS else "chose" if deliberate(r) else "failed"].append(r)
ends = {}
for k in ("chose", "failed"):
e = {}
for r in kinds[k]:
seq = place_path(r)
if seq:
ends[seq[-1]] = ends.get(seq[-1], 0) + 1
item["ends"] = dict(sorted(ends.items(), key=lambda kv: -kv[1]))
out.append(item)
e[seq[-1]] = e.get(seq[-1], 0) + 1
ends[k] = dict(sorted(e.items(), key=lambda kv: -kv[1]))
out.append({"key": layer["key"], "label": layer["label"], "runs": len(sel),
"counts": {k: len(v) for k, v in kinds.items()},
"lines": {k: valley(v)["edges"] for k, v in kinds.items()}, "ends": ends})
unrouted = {s: sum(1 for r in runs if r["source"] == s) for s in M.get("path_unrouted", [])}
return {"layers": out, "unrouted": unrouted}