Files
Support-Agent/labeling/auto/revue-croisee/2026-11-04/finition/wildstrubel/outils/candidats.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

46 lines
2.7 KiB
Python

"""Les instants à regarder sur les vignettes dans les journées de turbulence : un rejet d'une mesure (capteur
rejeté à cette mesure, ni à la précédente ni à la suivante ; R3 exclue) ou une référence écartée une mesure
(inlier 0), hors des étiquettes de moins de 3 h qui couvrent déjà l'instant (bornes comprises : une borne est
la mesure d'avant ou d'après). Par instant : les capteurs, et les cibles acceptées dont un corr s'écarte de plus
de 5 bruits de la moyenne de ses deux voisines (saut d'une mesure), avec l'écart.
Usage : candidats.py"""
import sys, statistics as st
from datetime import datetime
sys.path.insert(0, sys.path[0])
from donnees import mesures, etiquettes
M, E = mesures(), etiquettes()
CIB = ('PA2_2', 'PA3_2', 'PA_9', 'PB1_2', 'PB2_2', 'PB4', 'PB_5')
temps = sorted({t for t, _ in M}); caps = sorted({c for _, c in M})
dt = lambda s: datetime.fromisoformat(s[:16])
rej = lambda t, c: (t, c) in M and float(M[(t, c)]['error_value']) > float(M[(t, c)]['error_threshold'])
hors = lambda t, c: (t, c) in M and not rej(t, c) and M[(t, c)]['inlier'] in ('0.0', '0')
val = lambda t, c, k: float(M[(t, c)][k]) if (t, c) in M and M[(t, c)][k] and not rej(t, c) else None
bruit = {}
for c in CIB:
for k in ('corr_x', 'corr_y'):
s = [x for x in (val(t, c, k) for t in temps) if x is not None]
bruit[c, k] = st.median(abs(b - a) for a, b in zip(s, s[1:]))
courtes = [(dt(x['debut']), dt(x['fin']), i) for i, x in E if (dt(x['fin']) - dt(x['debut'])).total_seconds() < 3 * 3600]
for eid, e in E:
if e['categorie'] != 'Visibility' or 'turbulence' not in e['description']:
continue
a, b = dt(e['debut']), dt(e['fin'])
print(f'\n=== {eid} {a:%d/%m %H:%M} -> {b:%H:%M}')
for t in [t for t in temps if a <= t <= b]:
k = temps.index(t); av = temps[k - 1]; ap = temps[k + 1] if k + 1 < len(temps) else None
seuls = [c for c in caps if c != 'R3' and rej(t, c) and not rej(av, c) and not (ap and rej(ap, c))]
ec = [c for c in caps if c != 'R3' and hors(t, c) and not hors(av, c) and not (ap and hors(ap, c))]
if not seuls and not ec:
continue
cov = [i for d, f, i in courtes if d <= t <= f]
sauts = []
for c in CIB:
for kk in ('corr_x', 'corr_y'):
v, v1, v2 = val(t, c, kk), val(av, c, kk), ap and val(ap, c, kk)
if None not in (v, v1, v2):
z = (v - (v1 + v2) / 2) / bruit[c, kk]
if abs(z) > 5:
sauts.append(f'{c}{kk[-1]}{z:+.0f}')
print(f' {t:%H:%M} rej:{",".join(seuls):26} écartées:{",".join(ec):12} sauts:{" ".join(sauts):40} {"COUVERT " + " ".join(cov) if cov else ""}')