Files
Support-Agent/labeling/auto/etiqueteur/MICHIGAN_2026-10-01/outils/heures.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

24 lines
1.2 KiB
Python

"""Températures horaires sur une fenêtre, avec la médiane des cibles aux instants de mesure.
Lancer depuis la racine : python3 labeling/auto/etiqueteur/MICHIGAN_2026-10-01/outils/heures.py DEBUT FIN
"""
import csv, glob, sys
from datetime import datetime
D, OUT = "data/MICHIGAN", "labeling/auto/etiqueteur/MICHIGAN_2026-10-01"
A, B = datetime.fromisoformat(sys.argv[1]), datetime.fromisoformat(sys.argv[2])
SENS = ["A0", "CPU", "GPU", "PLL", "thermal"]
tab = {}
for s in SENS:
for f in sorted(glob.glob(f"{D}/metrics/MICHIGAN_sensor_{s}_deg_c_*.csv")):
for r in csv.DictReader(open(f)):
t = datetime.fromisoformat(r["time_utc"][:19].replace(" ", "T"))
if A <= t <= B:
tab.setdefault(t, {})[s] = r["metric"]
cor = {datetime.fromisoformat(r["instant"][:-1]): r
for r in csv.DictReader(open(f"{OUT}/temp_corr.tsv"), delimiter="\t")}
print("heure " + " ".join(f"{s:>7}" for s in SENS) + " cx_med cy_med sepx sepy")
for t in sorted(set(tab) | {k for k in cor if A <= k <= B}):
c = cor.get(t)
print(f"{t:%d.%m %H:%M} " + " ".join(f"{tab.get(t, {}).get(s, '-'):>7}" for s in SENS)
+ (f" {c['cx_med']:>6} {c['cy_med']:>6} {c['sepx']:>6} {c['sepy']:>6}" if c else ""))