Files
Support-Agent/labeling/auto/etiqueteur/WILDSTRUBEL_2026-09-07/outils/instants.py
T
maximeandClaude Opus 5.5 35b5ed4d74 Auto labels reviewed per station and cross-reviewed; all labeling knowledge in labeling/ (D-130)
- Every station's auto labels reviewed by an analyst (/review-auto-labels), then a
  cross-review per family across all stations (new skill /cross-review-labels),
  a finishing pass, and descriptions rewritten in words (no numeric values).
- The three never-labeled ranges (WILDSTRUBEL 07/09-01/10, NORDEND 16/08-01/10)
  labeled and reviewed: 991 auto labels on 11 stations, labeling/controle.py at 0 errors.
- Labeling knowledge gathered in labeling/: regles-d-etiquetage.md (new), familles.md
  (settled boundaries), connaissances/ (notes moved from docs/, links updated),
  the label map rebuilt from reviewed labels, events and cases; events tied to their
  stations (PS_DES_COUDRES is JUNGFRAU). The labeler and reviewers read only labeling/.
- labels-map reads auto labels and events; decision D-130; living plan points 73-75.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:21:57 +01:00

55 lines
1.9 KiB
Python

"""Par instant du lot : cibles rejetées, cibles dont corr sort de > K bruits de leur niveau, références hors (rejetées).
Usage : python3 instants.py data/WILDSTRUBEL 2026-09-01 2026-09-06 [K]
"""
import csv, glob, sys, statistics as st
from collections import defaultdict
d, j0, j1 = sys.argv[1], sys.argv[2], sys.argv[3]
K = float(sys.argv[4]) if len(sys.argv) > 4 else 5
rows = []
for f in sorted(glob.glob(f"{d}/displacement/*_advanced_*.csv")):
day = f[-12:-4]
if not (j0.replace('-', '') <= day <= j1.replace('-', '')):
continue
rows += list(csv.DictReader(open(f)))
def q(t): # quart d'heure
h, m = t[11:13], int(t[14:16])
return f"{t[:10]}T{h}:{m - m % 15:02d}Z"
ser = defaultdict(list)
for r in rows:
ser[r['sensor_name']].append(r)
lvl = {}
for s, rs in ser.items():
for c in ('corr_x', 'corr_y'):
v = [float(r[c]) for r in rs if r[c] and float(r['error_value']) <= float(r['error_threshold'])]
if len(v) < 10:
continue
med = st.median(v)
noise = st.median(abs(a - b) for a, b in zip(v, v[1:])) or 1e-9
lvl[s, c] = (med, noise)
by_t = defaultdict(lambda: {'rej_c': [], 'rej_r': [], 'out': []})
for s, rs in ser.items():
for r in rs:
t = q(r['time_utc'])
rej = float(r['error_value']) > float(r['error_threshold'])
ref = r['pattern_type'] == 'global_ref'
if rej:
by_t[t]['rej_r' if ref else 'rej_c'].append(s)
continue
if ref:
continue
for c in ('corr_x', 'corr_y'):
if r[c] and (s, c) in lvl:
med, n = lvl[s, c]
z = (float(r[c]) - med) / n
if abs(z) > K:
by_t[t]['out'].append(f"{s}.{c[-1]}{z:+.0f}")
for t in sorted(by_t):
b = by_t[t]
if b['rej_c'] or b['out']:
print(t, '| cibles rej:', ','.join(b['rej_c']) or '-', '| corr:', ' '.join(b['out']) or '-', '| réf rej:', ','.join(b['rej_r']) or '-')