Files
aimsight-labeling/auto/revue-croisee/2026-11-04/finition/nordend/outils/creux.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

31 lines
1.8 KiB
Python

"""Heure par heure, pour chaque étiquette Thermal displacement de NORDEND : corr_x d'un capteur (défaut PR18) face au niveau
des 5 dernières heures de l'étiquette (la fin de la nuit, avant le départ suivant ; à défaut, la médiane de l'étiquette),
en bruits (médiane des écarts entre deux mesures acceptées), sur les 16 premières heures. Lit le cache de jours_td.py.
Usage, depuis la racine : python3 <ce fichier> [CAPTEUR] [COLONNE] [ID ...]"""
import json, os, pickle, statistics as st, sys
from datetime import timedelta
sys.path.insert(0, "agent-tools")
from donnees import instant # noqa: E402
H = timedelta(hours=1)
M, C, T = pickle.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "cache.pkl"), "rb"))
L = [json.loads(l) for l in open("labeling/auto/NORDEND.jsonl")]
cap = sys.argv[1] if len(sys.argv) > 1 else "PR18"
col = sys.argv[2] if len(sys.argv) > 2 else "corr_x"
ids = [int(x.lstrip("#")) for x in sys.argv[3:]] or [i for i, l in enumerate(L, 1) if l["categorie"] == "Thermal displacement"]
for i in ids:
l = L[i - 1]
t0, t1 = instant(l["debut"]), instant(l["fin"])
pts = [(m["t"], m[col]) for m in M[cap] if m[col] is not None and t0 <= m["t"] <= t1]
if len(pts) < 5:
print(f"#{i} {l['debut'][5:10]} {cap} {col} : moins de 5 mesures")
continue
nz = st.median(abs(pts[k + 1][1] - pts[k][1]) for k in range(len(pts) - 1))
ref = [v for t, v in pts if t >= t1 - 5 * H]
b = st.median(ref) if len(ref) >= 4 else st.median(v for _, v in pts)
h = {}
for t, v in pts:
h.setdefault(t.replace(minute=0, second=0, microsecond=0), []).append(v)
print(f"#{i} {l['debut'][5:10]} {cap}.{col[-1]} ({'fin' if len(ref) >= 4 else 'médiane'}) :",
" ".join(f"{k:%H}:{(st.median(v) - b) / nz:+.0f}" for k, v in sorted(h.items()) if k - t0 <= 16 * H))