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

19 lines
1.4 KiB
Python

"""Bruit propre (médiane des |écarts entre deux mesures| acceptées) de jour (07-17 h) et de nuit (20-04 h), par capteur, lot 10-15/08, et error_value médiane.
Lancer depuis la racine : python3 labeling/auto/etiqueteur/NORDEND_2026-08-10/outils/bruit_jour.py"""
import csv, statistics as st
from datetime import datetime
d = {}
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):
d.setdefault(r["sensor_name"], []).append(r)
print("capteur bx_jour bx_nuit ratio | by_jour by_nuit ratio | err_jour err_nuit")
for c, rows in sorted(d.items()):
out = {}
for nom, ok in (("j", lambda h: 7 <= h < 17), ("n", lambda h: h >= 20 or h < 4)):
for col in ("corr_x", "corr_y"):
v = [(datetime.fromisoformat(r["time_utc"]), float(r[col])) for r in rows if r[col] and float(r["error_value"]) <= float(r["error_threshold"])]
out[nom + col] = st.median(abs(b[1] - a[1]) for a, b in zip(v, v[1:]) if ok(a[0].hour) and ok(b[0].hour) and (b[0] - a[0]).seconds < 1000)
out[nom + "e"] = st.median(float(r["error_value"]) for r in rows if ok(datetime.fromisoformat(r["time_utc"]).hour))
print(f"{c:7} {out['jcorr_x']:.4f} {out['ncorr_x']:.4f} {out['jcorr_x']/out['ncorr_x']:4.1f} | {out['jcorr_y']:.4f} {out['ncorr_y']:.4f} {out['jcorr_y']/out['ncorr_y']:4.1f} | {out['je']:.3f} {out['ne']:.3f}")