Files
aimsight-labeling/auto/revue-croisee/2026-11-04/carte/outils/rattacher_events.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

43 lines
1.8 KiB
Python

"""Rattacher chaque event (noms codés) à sa station de data/ : mêmes instants, mêmes valeurs.
python3 labeling/auto/revue-croisee/2026-11-04/carte/outils/rattacher_events.py
Pour chaque event : la station dont les mesures ont le même time_utc et la même error_value,
et la table capteur codé -> capteur réel (par x, y au même instant).
"""
import csv
import glob
import os
RACINE = os.path.join(os.path.dirname(__file__), *[".."] * 6)
def lignes(chemin):
with open(chemin, encoding="utf-8") as f:
yield from csv.DictReader(f)
for ev in sorted(glob.glob(f"{RACINE}/events/E-*/")):
nom = os.path.basename(ev.rstrip("/"))
fichiers = sorted(glob.glob(f"{ev}displacement/*advanced*.csv"))
if not fichiers:
print(nom, ": pas de fichier advanced")
continue
codees = {}
for l in lignes(fichiers[0]):
if l["error_value"]:
codees[(l["time_utc"], l["error_value"])] = l["sensor_name"].strip()
jours = sorted({t[:10].replace("-", "") for t, _ in codees})
trouve = {}
for station in sorted(os.listdir(f"{RACINE}/data")):
for jour in jours[:3]:
for chemin in glob.glob(f"{RACINE}/data/{station}/displacement/*_{jour}.csv"):
for l in lignes(chemin):
code = codees.get((l["time_utc"], l["error_value"]))
if code:
trouve.setdefault(station, {})[code] = l["sensor_name"].strip()
if not trouve:
print(nom, ": aucune station de data/ (jours", jours[0], "à", jours[-1], ")")
for station, table in trouve.items():
print(nom, "->", station, f"({len(table)} capteurs) :",
", ".join(f"{c}={r}" for c, r in sorted(table.items(), key=lambda x: (x[0][0], int(x[0][1:]) if x[0][1:].isdigit() else 0))))