Files
aimsight-labeling/auto/revue-croisee/2026-11-04/finition/nordend/outils/heures.py
T
maximeandClaude Opus 5.5 14ad6ea3f9 Auto labels reviewed per station and cross-reviewed; all labeling knowledge in labeling/ (D-130)
- Every station's auto labels reviewed by an analyst (/review-auto-labels), then a
  cross-review per family across all stations (new skill /cross-review-labels),
  a finishing pass, and descriptions rewritten in words (no numeric values).
- The three never-labeled ranges (WILDSTRUBEL 07/09-01/10, NORDEND 16/08-01/10)
  labeled and reviewed: 991 auto labels on 11 stations, labeling/controle.py at 0 errors.
- Labeling knowledge gathered in labeling/: regles-d-etiquetage.md (new), familles.md
  (settled boundaries), connaissances/ (notes moved from docs/, links updated),
  the label map rebuilt from reviewed labels, events and cases; events tied to their
  stations (PS_DES_COUDRES is JUNGFRAU). The labeler and reviewers read only labeling/.
- labels-map reads auto labels and events; decision D-130; living plan points 73-75.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:21:57 +01:00

36 lines
1.9 KiB
Python

"""Heure par heure, sur une fenêtre : pose de la caméra (pan, tilt, scale, rotation), température du boîtier, et corr_x, corr_y
des capteurs demandés (écart à leur médiane de la fenêtre, en bruits = médiane des écarts entre deux mesures).
Valeur à l'heure = médiane des mesures acceptées de l'heure. Lit le cache de jours_td.py.
Usage, depuis la racine : python3 <ce fichier> DEBUT FIN [CAPTEUR,...]"""
import os, pickle, statistics as st, sys
sys.path.insert(0, "agent-tools")
from donnees import instant # noqa: E402
M, C, T = pickle.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "cache.pkl"), "rb"))
t0, t1 = instant(sys.argv[1]), instant(sys.argv[2])
caps = sys.argv[3].split(",") if len(sys.argv) > 3 else ["PR18", "PR16", "PR15", "PR14", "PR13", "PR17", "PR09", "PR02", "CTR02", "CTR03", "CTR04"]
h = lambda t: t.replace(minute=0, second=0, microsecond=0)
cols = {}
for s in caps:
for c in ("corr_x", "corr_y"):
pts = [(m["t"], m[c]) for m in M.get(s, []) if m[c] is not None and t0 <= m["t"] <= t1]
if len(pts) < 5:
continue
med = st.median(v for _, v in pts)
nz = st.median(abs(pts[i + 1][1] - pts[i][1]) for i in range(len(pts) - 1)) or 1e-9
par = {}
for t, v in pts:
par.setdefault(h(t), []).append((v - med) / nz)
cols[f"{s}.{c[-1]}"] = {k: st.median(v) for k, v in par.items()}
pose = {}
for p in C:
if t0 <= p["t"] <= t1:
pose.setdefault(h(p["t"]), []).append(p)
temp = {h(t): v for t, v in T if t0 <= t <= t1}
print("heure temp pan tilt scale rot | " + " ".join(f"{k:>7s}" for k in cols))
for k in sorted(pose):
P = pose[k]
g = lambda a: st.median(x[a] for x in P if x[a] is not None)
print(f"{k:%d %H}h {temp.get(k, float('nan')):5.1f} {g('pan'):+.4f} {g('tilt'):+.4f} {g('scale'):.5f} {g('rotation'):+.4f} | "
+ " ".join(f"{cols[c].get(k, float('nan')):+7.1f}" for c in cols))