- End-of-session page for /boucle: the session's curves, the analyst's labels against the detectors' events per category, a plain score table and the benchmark (comparaison.py, D-066) - Detectors moved to vues-deplacements/detectors/ (D-067) - Detectors must detect everything; what the client sees is a separate layer (D-068) - Benchmark: each case keeps its labels from creation (etiquettes.json), benchmark.py scores the detectors on every case, history in vues-deplacements/benchmark/historique.csv; run by /boucle at each lot, after each change and at the end, read by the upgrader and validator; labels for C-001..C-005 from one analyst pass corrected by their files, C-006..C-008 from lot 01 (D-069) - Fixes from the releveur's notes: /boucle arguments and other sessions, branch name in the spec, detector name in categories.py output, learned case header, anonymiser.py (camera/, no empty CSVs, --etiquettes), ensemble.py (clock-aligned steps, title), plages.py (same-sign merge), labeling request written into /nouveau-cas - Also carries the other session's uncommitted D-065 edits in the same files; data/, .gitignore, pomper.py and stations.py are left out Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
"""Journal du matin : moments sans mesure (cadence de l'export « advanced » rompue).
|
|
|
|
Cadence : écart médian entre deux instants de mesure, tous capteurs confondus. Un trou : plus de 2 pas manquants entre
|
|
deux mesures (écart > 3 cadences) ; l'épisode va de la dernière mesure à la suivante. Pas de mesure dans l'export ne
|
|
veut pas dire station arrêtée (CLAUDE.md) : le texte dit seulement que l'export n'a rien.
|
|
Usage : python3 vues-deplacements/detectors/trous.py <dossier de station> (affiche les épisodes)
|
|
"""
|
|
import os
|
|
import statistics
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "agents", "diagnostic", "outils"))
|
|
from donnees import charger, iso # noqa: E402
|
|
|
|
MISSING = 2 # au-delà de 2 pas manquants, c'est un trou (consigne de l'utilisateur, 2026-10-23)
|
|
|
|
|
|
def duration(s):
|
|
h, m = divmod(round(s / 60), 60)
|
|
return f"{h} h {m:02d} min" if h else f"{m} min"
|
|
|
|
|
|
def detect(mesures):
|
|
ts = sorted({m["t"].replace(second=0, microsecond=0) for ms in mesures.values() for m in ms})
|
|
if len(ts) < 3:
|
|
return []
|
|
gaps = [(b - a).total_seconds() for a, b in zip(ts, ts[1:])]
|
|
step = statistics.median(gaps)
|
|
return [{"start": iso(a), "end": iso(b), "kind": "trous", "label": "No data",
|
|
"text": f"No measurement in the export for {duration(g)} (usually one every {duration(step)}).",
|
|
"ignore": False, "sensors": []}
|
|
for a, b, g in zip(ts, ts[1:], gaps) if g > (MISSING + 1) * step]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
for e in detect(charger(sys.argv[1])):
|
|
print(e)
|