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

39 lines
1.7 KiB
Python

"""Par instant : médiane, sur les cibles acceptées aux deux instants, du pas de corr_x et corr_y depuis l'instant précédent,
nombre de cibles dont |pas| > K bruits (bruit = médiane des |pas| du capteur), et error_value max des références.
usage: sauts.py DEBUT FIN [K]"""
import sys, statistics as st
sys.path.insert(0, 'labeling/auto/etiqueteur/NIEDERHORN_2026-10-01/outils')
from table import charge
debut, fin = sys.argv[1:3]
K = float(sys.argv[3]) if len(sys.argv) > 3 else 5
rows = charge(debut, fin)
ser = {}
refs = {}
for r in rows:
if r['pattern_type'] == 'global_ref':
refs.setdefault(r['t'], []).append(float(r['error_value']))
continue
if r['corr_x'] == '':
continue
ser.setdefault(r['sensor_name'], {})[r['t']] = (float(r['corr_x']), float(r['corr_y']))
ts = sorted({r['t'] for r in rows})
bruit = {}
for c, s in ser.items():
tt = sorted(s)
dx = [abs(s[b][0] - s[a][0]) for a, b in zip(tt, tt[1:])]
dy = [abs(s[b][1] - s[a][1]) for a, b in zip(tt, tt[1:])]
if len(dx) > 10:
bruit[c] = (st.median(dx) or 1e-3, st.median(dy) or 1e-3)
print('instant med_dx med_dy n>K refmax capteurs>K')
for a, b in zip(ts, ts[1:]):
dxs, dys, gros = [], [], []
for c, s in ser.items():
if c in bruit and a in s and b in s:
dx, dy = s[b][0] - s[a][0], s[b][1] - s[a][1]
dxs.append(dx); dys.append(dy)
if abs(dx) > K * bruit[c][0] or abs(dy) > K * bruit[c][1]:
gros.append(c.replace('PWD_', '').replace('_C09', ''))
if dxs:
print(b[5:16], f"{st.median(dxs):+.3f} {st.median(dys):+.3f} {len(gros):3d} {max(refs.get(b, [0])):.2f}", ' '.join(gros))