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

22 lines
1.2 KiB
Python

"""Écarts brefs : chaque cible face à la médiane de ses 2 mesures d'avant et 2 d'après ; instants où beaucoup de cibles s'écartent ensemble."""
import csv, glob, statistics as st
d = {}
for f in sorted(glob.glob("data/NEBRASKA/displacement/*.csv")):
for r in csv.DictReader(open(f)):
if r["pattern_type"] != "target" or r["corr_x"] == "" or float(r["error_value"]) > float(r["error_threshold"]): continue
k = r["time_utc"][:16]
if k > "2026-11-01T00:01": continue
d.setdefault(r["sensor_name"], {})[k] = (float(r["corr_x"]), float(r["corr_y"]))
ks = sorted({k for c in d for k in d[c]})
for j, col in enumerate(("corr_x", "corr_y")):
dev = {}
for c in d:
s = [d[c][k][j] for k in ks]
e = [s[i] - st.median(s[max(0, i - 2):i] + s[i + 1:i + 3]) for i in range(len(s))]
b = st.median([abs(x) for x in e]) or 1e-9
for k, x in zip(ks, e): dev.setdefault(k, []).append(x / b)
print(f"== {col} : instants où ≥ 6 cibles sur 12 s'écartent de > 3 bruits du même côté (bruit = médiane |écart|)")
for k in ks:
up = sum(x > 3 for x in dev[k]); dn = sum(x < -3 for x in dev[k])
if max(up, dn) >= 6: print(f" {k} +{up} -{dn} médiane {st.median(dev[k]):+.1f}")