Files
Support-Agent/labeling/auto/etiqueteur/LENZSPITZE_2026-10-01/outils/thermique.py
T
maximeandClaude Opus 5.5 6fbd7510b7 Etiqueteur: October labels for 8 stations; its folder moves to labeling/auto/etiqueteur/, analyses and scripts versioned (D-126)
Labels for CLARIDEN, FLORIDA, JUNGFRAU (gaps 06-20.10, 26.10-01.11), LENZSPITZE,
NIEDERHORN, NORDEND, SNCF01, WILDSTRUBEL. Figures and tool outputs stay out of git.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:33:41 +01:00

32 lines
2.3 KiB
Python

"""Par jour et par heure : écart de la médiane horaire de corr à la médiane de la nuit d'avant (00-04 h UTC), pour quelques
cibles (en centièmes) et pose de la caméra (pan, tilt en millièmes de degré), et temperature_deg_c."""
import csv, glob, collections, statistics as st, sys
CAPS = sys.argv[1].split(',') if len(sys.argv) > 1 else ['1020', '1021', '1014', '1007']
COL = sys.argv[2] if len(sys.argv) > 2 else 'corr_y'
v = collections.defaultdict(list)
for f in sorted(glob.glob('data/LENZSPITZE/displacement/*.csv')):
for r in csv.DictReader(open(f)):
if r['sensor_name'] in CAPS and r[COL] and float(r['error_value']) <= float(r['error_threshold']):
v[(r['sensor_name'], r['time_utc'][:10], int(r['time_utc'][11:13]))].append(float(r[COL]))
cam = collections.defaultdict(list)
for f in glob.glob('data/LENZSPITZE/camera/*.csv'):
for r in csv.DictReader(open(f)):
cam[(r['time_utc'][:10], int(r['time_utc'][11:13]))].append((float(r['median_pan']), float(r['median_tilt'])))
T = {}
for f in glob.glob('data/LENZSPITZE/metrics/LENZSPITZE_temperature_deg_c_*.csv'):
for r in csv.DictReader(open(f)):
if r['metric']: T[(r['time_utc'][:10], int(r['time_utc'][11:13]))] = float(r['metric'])
jours = sorted({k[1] for k in v if k[1] < '2026-11-01'})
for j in jours:
print(f"== {j} heures 04..21 ; {COL} - nuit (centièmes) ; cam pan/tilt - nuit (millièmes de deg) ; T")
nuit = {s: st.median(sum((v.get((s, j, h), []) for h in range(0, 5)), [])) for s in CAPS if any(v.get((s, j, h)) for h in range(0, 5))}
cn = [c for h in range(0, 5) for c in cam.get((j, h), [])]
pn = st.median(c[0] for c in cn) if cn else None; tn = st.median(c[1] for c in cn) if cn else None
for s in CAPS:
if s not in nuit: print(f" {s}: pas de nuit"); continue
print(f" {s:5s} " + ' '.join(f"{(st.median(v[(s,j,h)]) - nuit[s]) * 100:+5.0f}" if v.get((s, j, h)) else ' .' for h in range(4, 22)))
if pn is not None:
print(" pan " + ' '.join(f"{(st.median(c[0] for c in cam[(j,h)]) - pn) * 1000:+5.1f}" if cam.get((j, h)) else ' .' for h in range(4, 22)))
print(" tilt " + ' '.join(f"{(st.median(c[1] for c in cam[(j,h)]) - tn) * 1000:+5.1f}" if cam.get((j, h)) else ' .' for h in range(4, 22)))
print(" T " + ' '.join(f"{T[(j,h)]:5.1f}" if (j, h) in T else ' .' for h in range(4, 22)))