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>
55 lines
2.3 KiB
Python
55 lines
2.3 KiB
Python
"""Par jour : température du boîtier, cycle de la caméra (tilt, pan), creux de corr_x de PR18 et des cibles de droite.
|
|
Lancer depuis la racine : python3 labeling/auto/etiqueteur/NORDEND_2026-10-01/outils/jour_thermique.py"""
|
|
import csv, glob, statistics as st
|
|
from collections import defaultdict
|
|
|
|
D = "data/NORDEND"
|
|
jours = [f"2026-10-{d:02d}" for d in range(1, 32)]
|
|
|
|
temp = {}
|
|
for f in glob.glob(f"{D}/metrics/NORDEND_sensor_thermal_deg_c_2026_10_*"):
|
|
for r in csv.DictReader(open(f)):
|
|
if r["metric"]:
|
|
temp[r["time_utc"][:13]] = float(r["metric"])
|
|
|
|
cam = {}
|
|
for j in jours:
|
|
for r in csv.DictReader(open(f"{D}/camera/NORDEND_camera_{j.replace('-', '')}.csv")):
|
|
cam[r["time_utc"][:16]] = (float(r["median_pan"]), float(r["median_tilt"]))
|
|
|
|
corr = defaultdict(dict) # capteur -> t -> (cx, cy)
|
|
for j in jours:
|
|
for r in csv.DictReader(open(f"{D}/displacement/NORDEND_advanced_{j.replace('-', '')}.csv")):
|
|
if r["corr_x"] and r["pattern_type"] != "global_ref":
|
|
corr[r["sensor_name"]][r["time_utc"][:16]] = float(r["corr_x"])
|
|
|
|
def hm(t):
|
|
return int(t[11:13]) + int(t[14:16]) / 60
|
|
|
|
print("jour Tmin Tmax tilt_nuit tilt_max@ début_montée pan_min@ PR18_creux@ fin_retour")
|
|
for j in jours:
|
|
ts = sorted(t for t in cam if t.startswith(j))
|
|
T = [temp[h] for h in temp if h.startswith(j)]
|
|
nuit = [cam[t][1] for t in ts if hm(t) < 5]
|
|
if not nuit:
|
|
continue
|
|
n0 = st.median(nuit)
|
|
jour_ts = [t for t in ts if 5 <= hm(t) <= 16]
|
|
tmax = max(jour_ts, key=lambda t: cam[t][1])
|
|
amp = cam[tmax][1] - n0
|
|
debut = next((t for t in jour_ts if cam[t][1] - n0 > 0.25 * amp), None)
|
|
pmin = min(jour_ts, key=lambda t: cam[t][0])
|
|
p = corr["PR18"]
|
|
pn = [p[t] for t in p if t.startswith(j) and hm(t) < 5]
|
|
pj = [t for t in sorted(p) if t.startswith(j) and 5 <= hm(t) <= 20]
|
|
if pn and pj:
|
|
lvl = st.median(pn)
|
|
creux = min(pj, key=lambda t: p[t])
|
|
a = p[creux] - lvl
|
|
fin = next((t for t in pj if t > creux and p[t] - lvl > 0.25 * a), "-")
|
|
d2 = next((t for t in pj if p[t] - lvl < 0.25 * a), "-")
|
|
s18 = f"{a:+.3f} {creux[11:]} {d2[11:]}→{fin[11:]}"
|
|
else:
|
|
s18 = "-"
|
|
print(f"{j} {min(T):5.1f} {max(T):5.1f} {n0:+.4f} {amp:+.4f} {tmax[11:]} {debut[11:] if debut else '-'} {cam[pmin][0]:+.4f} {pmin[11:]} {s18}")
|