sessions of 2026-11-18 (the optimization campaign; three runs without summary, interrupted and rerun)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 17:47:59 +01:00
1 parent 8a81c53cd9
commit 0cfbd1b7bc
363 files changed
+30822

No files matched your search

@@ -0,0 +1,63 @@
# Per heat shimmer episode of each benchmark station: share labelled Visibility, and how far the targets go from their local level (in noises).
# Usage: python3 shimmer_stats.py <detectors dir> <labels dir> <data dir> [STATION,...]
import statistics
import sys
from datetime import timedelta
from pathlib import Path
det = Path(sys.argv[1]).resolve()
sys.path[:0] = [str(det / "scripts"), str(det / "bench")]
import categories # noqa: E402,F401 (puts data.py on the path)
import score # noqa: E402
import visibility # noqa: E402
from data import is_reference, iso, load, parse_time # noqa: E402
from episodes import noise # noqa: E402
import regression # noqa: E402
labels_dir, data_dir = Path(sys.argv[2]), Path(sys.argv[3])
only = sys.argv[4].split(",") if len(sys.argv) > 4 else None
ROLL = timedelta(hours=3)
for path in sorted(labels_dir.glob("*.jsonl")):
st = path.stem
if only and st not in only or not (data_dir / st).is_dir():
continue
start, end = regression.label_range(path)
labels = score.read_labels(str(path), start, end)
vis = [l for l in labels if l["family"] == "Visibility"]
ms = load(str(data_dir / st))
h, b = parse_time(start) - timedelta(days=3), parse_time(end)
chunk = {s: k for s, v in ms.items() if (k := [m for m in v if h <= m["t"] < b])}
noises = {}
for s, v in chunk.items():
if is_reference(v):
continue
noises[s] = (noise([m["corr_x"] for m in v if m["corr_x"] is not None]),
noise([m["corr_y"] for m in v if m["corr_y"] is not None]))
for e in visibility.heat_shimmer(chunk):
if e["end"] < start:
continue
a, z = parse_time(e["start"]), parse_time(e["end"])
inst = sorted({m["t"] for v in chunk.values() for m in v if a <= m["t"] <= z})
lab = sum(any(l["start"] < iso(t) < l["end"] for l in vis) for t in inst)
best, counts = 0, []
for s, (nx, ny) in noises.items():
v = chunk[s]
dev = 0
n_over = 0
for i, m in enumerate(v):
if not (a <= m["t"] <= z):
continue
for c, nn in (("corr_x", nx), ("corr_y", ny)):
if m[c] is None or not nn:
continue
around = [w[c] for w in v if abs(w["t"] - m["t"]) <= ROLL and w[c] is not None and w is not m]
if len(around) < 3:
continue
d = abs(m[c] - statistics.median(around)) / nn
dev = max(dev, d)
best = max(best, dev)
counts.append(round(dev, 1))
counts.sort(reverse=True)
print(f"{st:12} {e['start']} {e['end']} ignore={e['ignore']!s:5} n={len(inst):3} lab={lab:3} "
f"maxdev={best:6.1f} top={counts[:4]}")