Files
Support-Agent/labeling/auto/etiqueteur/NORDEND_2026-08-10/outils/nuit.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

23 lines
1.4 KiB
Python

"""Dérive de nuit : par série clé, écart (en bruits) entre la fin du soir (19:00-20:00) et la fin de nuit suivante (04:30-05:30), et entre 20:00-21:00 et 23:00-24:00.
Lancer depuis la racine : python3 labeling/auto/etiqueteur/NORDEND_2026-08-10/outils/nuit.py"""
import csv, statistics as st
from datetime import datetime, timedelta, timezone
CLES = [("PR12", "corr_x"), ("PR14", "corr_x"), ("PR15", "corr_x"), ("PR16", "corr_x"), ("PR17", "corr_x"), ("PR18", "corr_x"), ("PR18", "corr_y"), ("CTR02", "corr_y"), ("PR02", "corr_y")]
s = {}
for j in range(10, 16):
with open(f"data/NORDEND/displacement/NORDEND_advanced_202608{j:02d}.csv") as f:
for r in csv.DictReader(f):
for c in ("corr_x", "corr_y"):
if r[c] and float(r["error_value"]) <= float(r["error_threshold"]):
s.setdefault((r["sensor_name"], c), []).append((datetime.fromisoformat(r["time_utc"]), float(r[c])))
for k in CLES:
v = sorted(s[k]); b = st.median(abs(y[1] - x[1]) for x, y in zip(v, v[1:]))
med = lambda a, z: st.median(x for t, x in v if a <= t < z)
ligne = f"{k[0]:5} {k[1]}: "
for j in range(10, 15):
d = datetime(2026, 8, j, tzinfo=timezone.utc)
soir = med(d + timedelta(hours=19), d + timedelta(hours=20))
fin = med(d + timedelta(hours=28, minutes=30), d + timedelta(hours=29, minutes=30))
ligne += f"{j}/08 {(fin - soir) / b:+5.1f} "
print(ligne)