Files
Support-Agent/labeling/auto/revue-croisee/2026-11-04/thermal-displacement/outils/profil.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

35 lines
2.1 KiB
Python

"""Profil jour moyen de la pose de la caméra, par heure UTC, sur les jours d'étiquettes thermiques d'une station.
Pour chaque jour civil UTC et chaque axe (pan, tilt, rotation, scale) : la médiane à l'heure, ramenée de 0 (plus bas du jour)
à 100 (plus haut du jour) ; puis la médiane sur les jours, heure par heure. Une suite d'heures au même niveau : la caméra
s'y repose ; une pente régulière jusqu'à l'aube : elle revient toute la nuit. Amplitude du jour en bruits horaires.
Usage, depuis la racine : python3 <ce fichier> STATION [AXE] (n'écrit rien)"""
import csv, glob, json, sys, statistics as st
from datetime import datetime, timedelta
AX = ['pan', 'tilt', 'rotation', 'scale']
def t(s): return datetime.fromisoformat(s.replace('Z', '+00:00').replace(' ', 'T'))
station = sys.argv[1]
h = {}
for p in sorted(glob.glob(f'data/{station}/camera/*.csv')):
for r in csv.DictReader(open(p)):
try: v = [float(r['median_' + a]) for a in AX]
except (ValueError, KeyError): continue
h.setdefault(t(r['time_utc']).replace(minute=0, second=0), []).append(v)
P = {k: [st.median(x[i] for x in l) for i in range(4)] for k, l in h.items()}
ks = sorted(P)
bruit = [st.median(abs(P[b][i] - P[a][i]) for a, b in zip(ks, ks[1:]) if b - a == timedelta(hours=1)) or 1e-9 for i in range(4)]
jours = sorted({t(json.loads(l)['debut']).date() for l in open(f'labeling/auto/{station}.jsonl')
if l.strip() and json.loads(l)['categorie'] == 'Thermal displacement'})
axes = [AX.index(sys.argv[2])] if len(sys.argv) > 2 else range(4)
for i in axes:
prof = {hh: [] for hh in range(24)}; amps = []
for j in jours:
d = {k.hour: P[k][i] for k in ks if k.date() == j}
if len(d) < 20: continue
lo, hi = min(d.values()), max(d.values())
if hi == lo: continue
amps.append((hi - lo) / bruit[i])
for hh, v in d.items(): prof[hh].append(100 * (v - lo) / (hi - lo))
if not amps: continue
print(f'{station} {AX[i]:8s} ampl. {st.median(amps):4.0f} bruits, {len(amps)} j :',
' '.join(f'{hh:02d}:{st.median(prof[hh]):3.0f}' if prof[hh] else f'{hh:02d}: -' for hh in range(24)))