Files
aimsight-labeling/auto/revue-croisee/2026-11-04/finition/nordend/outils/bornes.py
T
maximeandClaude Opus 5.5 14ad6ea3f9 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

44 lines
2.3 KiB
Python

"""Départ du matin de la pose, face aux bornes des étiquettes Thermal displacement de NORDEND.
Pour chaque borne (début, fin) : plus haut du pan lissé (3 mesures) entre borne-4 h et borne+2 h ; départ = première mesure
après ce plus haut où le pan lissé est sous ce plus haut de plus de 3 bruits (bruit = médiane des écarts entre deux poses
du lot) et y reste l'heure suivante ; la borne attendue est la mesure d'avant. Idem pour le tilt, qui monte (plus bas, puis départ au-dessus).
Les poses des gênes de toute la scène (GENES de jours_td.py) sont écartées. Lit le cache de jours_td.py.
Usage, depuis la racine : python3 <ce fichier>"""
import json, os, pickle, statistics as st, sys
from datetime import timedelta
sys.path.insert(0, "agent-tools")
from donnees import instant, iso # noqa: E402
H = timedelta(hours=1)
M, C, T = pickle.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "cache.pkl"), "rb"))
lignes = [json.loads(l) for l in open("labeling/auto/NORDEND.jsonl")]
GENES = (36, 38, 41, 42, 50, 52, 64, 79, 81, 88, 93)
AUTRES = [(instant(lignes[n - 1]["debut"]), instant(lignes[n - 1]["fin"])) for n in GENES]
libre = lambda t: not any(a < t < b for a, b in AUTRES)
def depart(ax, tb, signe):
pts = [(p["t"], signe * p[ax]) for p in C if p[ax] is not None and libre(p["t"]) and tb - 4 * H <= p["t"] <= tb + 4 * H]
if len(pts) < 10:
return None
nz = st.median(abs(pts[i + 1][1] - pts[i][1]) for i in range(len(pts) - 1))
s = [(pts[i][0], st.median(v for _, v in pts[max(0, i - 1):i + 2])) for i in range(len(pts))]
cand = [x for x in s if x[0] <= tb + 2 * H]
im = max(range(len(cand)), key=lambda i: cand[i][1])
for j in range(im + 1, len(s)):
if all(v < cand[im][1] - 3 * nz for t, v in s[j:] if t <= s[j][0] + H):
return s[j - 1][0]
return None
for i, l in enumerate(lignes, 1):
if l["categorie"] != "Thermal displacement":
continue
out = []
for nom in ("debut", "fin"):
tb = instant(l[nom])
dp, dt = depart("pan", tb, +1), depart("tilt", tb, -1) # le pan baisse, le tilt monte
f = lambda t: iso(t)[11:16] if t else " - "
out.append(f"{nom} {l[nom][5:16]} : départ pan {f(dp)}, tilt {f(dt)}")
print(f"NORDEND#{i:<3d} " + " | ".join(out))