Make diagnostic reports short, evidence-backed and anomaly-only (D-047)
Reports become a folder with rapport.md and its figures: a verdict, one short section per anomaly (series plot with shaded window, full-resolution image crops around the sensors), constant behaviour in one line each. graphique.py gains --zone and --sortie; new vignettes.py crops images at the sensors' raw x/y. Old reports removed; the blind rescan of PS des Coudres finds the single anomaly flagged by the specialist (REF_G/REF_D). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b937da95b
commit
2a39335fb5
12 files changed
+259
-253
No files matched your search
@@ -2,7 +2,9 @@
|
||||
|
||||
Usage : .venv/bin/python agents/diagnostic/outils/graphique.py data/PS_DES_COUDRES/
|
||||
[--capteurs CAPTEUR_A,CAPTEUR_B] [--colonnes error_value,corr_x,corr_y] [--debut ...] [--fin ...]
|
||||
Un panneau par colonne, une courbe par capteur, heures UTC. Imprime le chemin du PNG (out/diagnostic/).
|
||||
[--zone DEBUT/FIN ...] [--sortie DOSSIER]
|
||||
Un panneau par colonne, une courbe par capteur, heures UTC ; chaque --zone est grisée.
|
||||
Imprime le chemin du PNG (out/diagnostic/, ou --sortie : le dossier du rapport, pour une figure de preuve).
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
@@ -20,6 +22,14 @@ RACINE = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)
|
||||
COLONNES = ("error_value", "corr_x", "corr_y", "relative_x", "relative_y", "x", "y", "sigma0", "reproj_err")
|
||||
|
||||
|
||||
def zone(texte):
|
||||
"""'2026-10-13T01:00Z/2026-10-13T03:00Z' -> (début, fin)."""
|
||||
debut, sep, fin = texte.partition("/")
|
||||
if not sep:
|
||||
raise argparse.ArgumentTypeError(f"zone invalide : {texte!r} (ex. 2026-10-13T01:00Z/2026-10-13T03:00Z)")
|
||||
return instant(debut), instant(fin)
|
||||
|
||||
|
||||
def borne(t, defaut):
|
||||
return t.strftime("%Y%m%dT%H%MZ") if t else defaut
|
||||
|
||||
@@ -31,6 +41,8 @@ def main():
|
||||
a.add_argument("--colonnes", default="error_value,corr_x,corr_y")
|
||||
a.add_argument("--debut", type=instant)
|
||||
a.add_argument("--fin", type=instant)
|
||||
a.add_argument("--zone", type=zone, action="append", default=[], help="fenêtre à griser, DEBUT/FIN (répétable)")
|
||||
a.add_argument("--sortie", default=os.path.join(RACINE, "out", "diagnostic"), help="dossier du PNG")
|
||||
o = a.parse_args()
|
||||
|
||||
par = charger(o.dossier)
|
||||
@@ -59,6 +71,8 @@ def main():
|
||||
ms = series[s] # une valeur vide devient NaN : la courbe s'interrompt au lieu de relier le trou
|
||||
ax.plot([m["t"] for m in ms], [float("nan") if m[col] is None else m[col] for m in ms], ".-", ms=2, lw=0.7,
|
||||
color=couleurs[i % len(couleurs)], label=s)
|
||||
for debut, fin in o.zone:
|
||||
ax.axvspan(debut, fin, color="0.85", zorder=0)
|
||||
ax.set_ylabel(col)
|
||||
ax.grid(alpha=0.3)
|
||||
axes[0, 0].legend(loc="upper left", bbox_to_anchor=(1.0, 1.0), fontsize=8)
|
||||
@@ -66,10 +80,9 @@ def main():
|
||||
station = os.path.basename(os.path.normpath(o.dossier))
|
||||
fig.suptitle(f"{station} : {', '.join(colonnes)} (heures UTC)")
|
||||
|
||||
dossier_sortie = os.path.join(RACINE, "out", "diagnostic")
|
||||
os.makedirs(dossier_sortie, exist_ok=True)
|
||||
os.makedirs(o.sortie, exist_ok=True)
|
||||
qui = "-".join(noms) if o.capteurs else "tous"
|
||||
sortie = os.path.join(dossier_sortie, f"{station}_{'-'.join(colonnes)}_{qui}_"
|
||||
sortie = os.path.join(o.sortie, f"{station}_{'-'.join(colonnes)}_{qui}_"
|
||||
f"{borne(o.debut, 'debut')}_{borne(o.fin, 'fin')}.png")
|
||||
fig.savefig(sortie, dpi=100, bbox_inches="tight")
|
||||
print(sortie)
|
||||
|
||||
Reference in new issue
Block a user