Files
Support-Agent/labeling/auto/etiqueteur/NORDEND_2026-10-01/outils/fig_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

39 lines
2.2 KiB
Python

"""Figure : température du boîtier, tilt et pan de la caméra, corr_x de PR18 et PR14, par semaine.
Lancer depuis la racine : .venv/bin/python labeling/auto/etiqueteur/NORDEND_2026-10-01/outils/fig_thermique.py"""
import csv, glob
from datetime import datetime, timedelta
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.dates as md
D = "data/NORDEND"
O = "labeling/auto/etiqueteur/NORDEND_2026-10-01"
P = lambda s: datetime.fromisoformat(s[:19])
temp = sorted((P(r["time_utc"]), float(r["metric"])) for f in glob.glob(f"{D}/metrics/NORDEND_sensor_thermal_deg_c_2026_1[01]_*")
for r in csv.DictReader(open(f)) if r["metric"])
cam = sorted((P(r["time_utc"]), float(r["median_pan"]), float(r["median_tilt"]))
for f in glob.glob(f"{D}/camera/NORDEND_camera_2026*.csv") for r in csv.DictReader(open(f)))
cx = {"PR18": [], "PR14": [], "PR16": []}
for f in sorted(glob.glob(f"{D}/displacement/NORDEND_advanced_2026*.csv")):
for r in csv.DictReader(open(f)):
if r["sensor_name"] in cx and r["corr_x"]:
cx[r["sensor_name"]].append((P(r["time_utc"]), float(r["corr_x"])))
for k, d0 in enumerate([datetime(2026, 10, 1), datetime(2026, 10, 9), datetime(2026, 10, 17), datetime(2026, 10, 25)]):
d1 = d0 + timedelta(days=8 if k < 3 else 7)
fig, ax = plt.subplots(4, 1, figsize=(16, 11), sharex=True)
sel = lambda L: [p for p in L if d0 <= p[0] <= d1]
t = sel(temp); ax[0].plot([a[0] for a in t], [a[1] for a in t], ".-"); ax[0].set_ylabel("sensor_thermal °C")
c = sel(cam)
ax[1].plot([a[0] for a in c], [a[2] for a in c], ".", ms=2); ax[1].set_ylabel("tilt")
ax[2].plot([a[0] for a in c], [a[1] for a in c], ".", ms=2); ax[2].set_ylabel("pan")
for n, L in cx.items():
s = sel(L); ax[3].plot([a[0] for a in s], [a[1] for a in s], ".", ms=2, label=n)
ax[3].set_ylabel("corr_x"); ax[3].legend(); ax[3].set_ylim(-0.3, 0.5)
for a in ax:
a.grid(alpha=.4); a.xaxis.set_major_locator(md.HourLocator(byhour=[0, 12])); a.xaxis.set_major_formatter(md.DateFormatter("%d/%m %Hh"))
plt.setp(ax[3].get_xticklabels(), rotation=60, fontsize=7)
fig.tight_layout(); fn = f"{O}/thermique_{d0:%m%d}.png"; fig.savefig(fn, dpi=80); print(fn)