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>
52 lines
2.4 KiB
Python
52 lines
2.4 KiB
Python
"""Par instant : cibles rejetees (hors cibles chroniques), references rejetees / inlier,
|
|
et cibles dont corr_x ou corr_y s'ecarte de la mediane de ses voisines dans le temps (+-2 pas)
|
|
de plus de K fois son bruit propre. N'imprime que les instants notables."""
|
|
import csv, glob, sys, statistics as st
|
|
from collections import defaultdict
|
|
|
|
CHRON = {"BG.1", "F4.1", "CV.7", "F4.4", "F4.3", "CV.6"}
|
|
K = 8
|
|
rows = defaultdict(dict) # t -> sensor -> row
|
|
for f in sorted(glob.glob("data/SNCF01/displacement/SNCF01_advanced_*.csv")):
|
|
for r in csv.DictReader(open(f)):
|
|
t = r["time_utc"][:16]
|
|
if "2026-10-04" <= t < "2026-11-01T00:01":
|
|
rows[t][r["sensor_name"]] = r
|
|
times = sorted(rows)
|
|
sensors = sorted({s for t in times for s in rows[t]})
|
|
refs = {s for s in sensors if rows[times[0]][s]["pattern_type"] == "global_ref"}
|
|
|
|
def val(t, s, c):
|
|
r = rows[t].get(s)
|
|
if not r or r[c] == "" or float(r["error_value"]) > float(r["error_threshold"]):
|
|
return None
|
|
return float(r[c])
|
|
|
|
noise = {}
|
|
for s in sensors:
|
|
for c in ("corr_x", "corr_y"):
|
|
v = [val(t, s, c) for t in times]
|
|
d = [abs(a - b) for a, b in zip(v, v[1:]) if a is not None and b is not None]
|
|
noise[s, c] = st.median(d) if d else None
|
|
|
|
for i, t in enumerate(times):
|
|
rej = [s for s in sensors if s not in refs and s not in CHRON and rows[t].get(s)
|
|
and float(rows[t][s]["error_value"]) > float(rows[t][s]["error_threshold"])]
|
|
rrej = [s for s in refs if float(rows[t][s]["error_value"]) > float(rows[t][s]["error_threshold"])]
|
|
rin = [s for s in refs if rows[t][s]["inlier"] not in ("1", "1.0", "True")]
|
|
jumps = []
|
|
for s in sensors:
|
|
if s in refs:
|
|
continue
|
|
for c in ("corr_x", "corr_y"):
|
|
v = val(t, s, c)
|
|
if v is None or not noise[s, c]:
|
|
continue
|
|
nb = [val(times[j], s, c) for j in range(max(0, i - 3), min(len(times), i + 4)) if j != i]
|
|
nb = [x for x in nb if x is not None]
|
|
if len(nb) >= 3 and abs(v - st.median(nb)) > K * noise[s, c]:
|
|
jumps.append(f"{s}:{c[-1]}{(v - st.median(nb)) / noise[s, c]:+.0f}")
|
|
if rej or rrej or rin or len(jumps) >= 1:
|
|
print(t, f"rej={len(rej)}", ",".join(rej[:6]) + ("…" if len(rej) > 6 else ""),
|
|
"| refrej=" + ",".join(rrej), "| hors_inlier=" + ",".join(rin), "| sauts:", " ".join(jumps))
|