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,22 @@
# Daily median error_value per sensor, and its share of measurements "high" by visibility.py's rule (median + K_MAD MAD and FACTOR x median over the window). Args: station_folder FROM TO sensor[,sensor...]
import sys, statistics
from datetime import datetime, timezone
sys.path[:0] = ["/home/maxime/aimsight-tools/scripts", "/home/maxime/aimsight-detectors/scripts"]
from data import load
from episodes import level
from visibility import K_MAD, FACTOR
folder, a, b, sensors = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4].split(",")
ms = load(folder)
a = datetime.fromisoformat(a).replace(tzinfo=timezone.utc)
b = datetime.fromisoformat(b).replace(tzinfo=timezone.utc)
days, lim = {}, {}
for s in sensors:
v = [m for m in ms.get(s, []) if a <= m["t"] < b and m["error_value"] is not None]
med, mad = level([m["error_value"] for m in v])
lim[s] = max(med + K_MAD * mad, FACTOR * med)
for m in v:
days.setdefault(m["t"].date(), {}).setdefault(s, []).append(m["error_value"])
print("limit " + " ".join(f"{lim[s]:>12.3g}" for s in sensors))
for d in sorted(days):
print(d, " ".join(f"{statistics.median(days[d][s]):7.3g} {100 * sum(x > lim[s] for x in days[d][s]) / len(days[d][s]):3.0f}%" if s in days[d] else " -" for s in sensors))