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,30 @@
# Per hour of [FROM, TO) (window read with 3 days of history): heat_shimmer's share of agitated sensors (>= RATIO) and
# median error_value ratio, as visibility.heat_shimmer computes them; label families. Args: <detectors dir> <station> <labels> FROM TO
import statistics, sys
from datetime import timedelta
from pathlib import Path
sys.path.insert(0, str(Path(sys.argv[1]).resolve() / "bench"))
import score # noqa: E402
import visibility as V # noqa: E402
from data import iso, load, parse_time # noqa: E402
det, folder, lab, a, b = sys.argv[1:6]
start, end = parse_time(a), parse_time(b)
ms = {s: k for s, v in load(folder).items() if (k := [m for m in v if start - timedelta(days=3) <= m["t"] < end])}
labels = score.read_labels(lab, iso(start), iso(end))
hours = {}
for s, v in ms.items():
ag = V._ratios([(y["t"], abs(y["corr_x"] - x["corr_x"]) + abs(y["corr_y"] - x["corr_y"]))
for x, y in zip(v, v[1:]) if x["corr_x"] is not None and y["corr_x"] is not None])
er = V._ratios([(m["t"], m["error_value"]) for m in v if m["error_value"] is not None])
for h in ag.keys() & er.keys():
hours.setdefault(h, {})[s] = (ag[h], er[h])
for h, r in sorted(hours.items()):
if not (start <= h < end):
continue
share = sum(x >= V.RATIO for x, _ in r.values()) / len(r)
e = statistics.median(y for _, y in r.values())
agm = statistics.median(x for x, _ in r.values())
ti = iso(h)
fam = ",".join(sorted({l["family"][:4] + l["id"][11:] for l in labels if l["start"] < ti < l["end"]}))
flag = "T" if share >= V.SHARE and e >= V.RATIO else " "
print(ti[5:16], f"share={share:4.2f} agit={agm:5.2f} err={e:5.2f} {flag}", fam)