Files
Support-Agent/labeling/auto/revue-croisee/2026-11-04/thermal-displacement/outils/nuits_axe.py
T
maximeandClaude Opus 5.5 35b5ed4d74 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
2.2 KiB
Python

"""Comme nuits.py, sur l'axe principal du cycle de la station (le plus ample de son profil jour moyen, profil.py),
lissé : médiane de la pose sur 2 h autour de chaque instant. Pour chaque écart de moins de 24 h entre deux
étiquettes thermiques : valeur à la fin, au plus loin de la fin dans l'écart, au départ suivant, en part de
l'amplitude du jour (24 h qui finissent à la fin de l'étiquette).
Usage, depuis la racine : python3 <ce fichier> STATION:AXE [STATION:AXE ...] (n'écrit rien)"""
import csv, glob, json, sys, statistics as st
from datetime import datetime, timedelta
def t(s): return datetime.fromisoformat(s.replace('Z', '+00:00').replace(' ', 'T'))
for arg in sys.argv[1:]:
station, ax = arg.split(':')
P = []
for p in sorted(glob.glob(f'data/{station}/camera/*.csv')):
for r in csv.DictReader(open(p)):
try: P.append((t(r['time_utc']), float(r['median_' + ax])))
except ValueError: pass
P.sort()
def v(k):
l = [x for d, x in P if abs(d - k) <= timedelta(hours=1)]
return st.median(l) if len(l) >= 3 else None
es = sorted((json.loads(l)['debut'], n, json.loads(l)) for n, l in enumerate(open(f'labeling/auto/{station}.jsonl'), 1)
if l.strip() and json.loads(l)['categorie'] == 'Thermal displacement')
print(f'== {station} {ax}')
parts = []
for (_, n1, e1), (_, n2, e2) in zip(es, es[1:]):
f, d = t(e1['fin']), t(e2['debut'])
if not timedelta(0) < d - f < timedelta(hours=24): continue
jour = [x for k, x in P if f - timedelta(hours=24) <= k <= f]
a, b = v(f), v(d)
if len(jour) < 10 or a is None or b is None: continue
amp = max(jour) - min(jour)
loin = max((abs(v(k) - a) for k in [f + timedelta(minutes=30 * i) for i in range(int((d - f) / timedelta(minutes=30)) + 1)] if v(k) is not None), default=0)
parts.append(abs(b - a) / amp)
print(f' #{n1} fin {e1["fin"][5:16]} -> #{n2} début {e2["debut"][5:16]} ({(d - f) / timedelta(hours=1):.1f} h) : '
f'marche {abs(b - a) / amp:.2f}, au plus loin {loin / amp:.2f} de l\'amplitude du jour')
if parts: print(f' médiane des marches : {st.median(parts):.2f} sur {len(parts)}')