Le benchmark dans bench/ ; plus de plugin : l'amélioration vit dans Optimizer, ses agents dans le dépôt agents

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 11:00:27 +01:00
1 parent 5438b0b469
commit e7c03e7304
9 files changed
+17 -316

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
"""For the upgrader: the cadence of the measurements of the range, the number of targets and references, then each event
of the range with its sensors (categories.py only gives their number). Same computation as categories.py without
--chunk (3 days of history).
Usage: python3 sensors.py <folder> --from YYYY-MM-DD --to YYYY-MM-DD
"""
import argparse
import statistics
import sys
from datetime import datetime, timedelta, timezone
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
import categories # noqa: E402
from data import iso, load # noqa: E402
p = argparse.ArgumentParser(usage=__doc__)
p.add_argument("folder")
p.add_argument("--from", dest="start", required=True)
p.add_argument("--to", dest="end", required=True)
a = p.parse_args()
day = lambda d: datetime.strptime(d[:10], "%Y-%m-%d").replace(tzinfo=timezone.utc) # noqa: E731
start, end = day(a.start), day(a.end)
batch = {s: k for s, ms in load(a.folder).items() if (k := [m for m in ms if start - timedelta(days=3) <= m["t"] < end])}
ts = sorted({m["t"] for ms in batch.values() for m in ms if m["t"] >= start})
steps = [(y - x).total_seconds() / 60 for x, y in zip(ts, ts[1:])]
print(f"cadence: {statistics.median(steps):.0f} min (median of the steps between measurements)" if steps else "cadence: no measurement")
refs = sum(ms[0]["pattern_type"] == "global_ref" for ms in batch.values())
print(f"sensors: {len(batch) - refs} targets, {refs} references")
for v in (v for v in categories.events(batch, end, a.folder) if v["end"] >= iso(start)) if batch else []:
print(v["start"], "→", v["end"], f"{v['category']:<20}", "|", v["episodes"][0]["label"], "|",
", ".join(sorted(v["sensors"])) or "all sensors")