- 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>
108 lines
4.2 KiB
Python
108 lines
4.2 KiB
Python
"""Séries corr_x, corr_y des cibles (mesures acceptées), axe borné aux centiles, et tilt de la caméra.
|
|
|
|
Usage : .venv/bin/python <ce fichier> DEBUT FIN [--table] [--capteurs A,B] [--nom N]
|
|
--table : imprime, à chaque instant, corr_x/corr_y de chaque cible (r = rejetée) et le nombre de références inlier.
|
|
Écrit le PNG dans le dossier parent de outils/.
|
|
"""
|
|
import csv, glob, os, sys
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
ICI = os.path.dirname(os.path.abspath(__file__))
|
|
SORTIE = os.path.dirname(ICI)
|
|
DATA = "data/WILDSTRUBEL"
|
|
CIBLES = ["PA2_2", "PA3_2", "PA_9", "PB1_2", "PB2_2", "PB4", "PB_5"]
|
|
|
|
|
|
def t(s):
|
|
return datetime.strptime(s[:16], "%Y-%m-%dT%H:%M").replace(tzinfo=timezone.utc)
|
|
|
|
|
|
def arrondi(s):
|
|
d = datetime.fromisoformat(s.replace(" ", "T"))
|
|
m = (d.minute + 7) // 15 * 15
|
|
return d.replace(minute=0, second=0, microsecond=0) + timedelta(minutes=m)
|
|
|
|
|
|
def lire(debut, fin):
|
|
rows = {}
|
|
jour = debut.date() - timedelta(days=1)
|
|
while jour <= fin.date():
|
|
f = f"{DATA}/displacement/WILDSTRUBEL_advanced_{jour:%Y%m%d}.csv"
|
|
if os.path.exists(f):
|
|
for r in csv.DictReader(open(f)):
|
|
ti = arrondi(r["time_utc"])
|
|
if debut <= ti <= fin:
|
|
rows[(ti, r["sensor_name"])] = r
|
|
jour += timedelta(days=1)
|
|
cam = {}
|
|
jour = debut.date() - timedelta(days=1)
|
|
while jour <= fin.date():
|
|
f = f"{DATA}/camera/WILDSTRUBEL_camera_{jour:%Y%m%d}.csv"
|
|
if os.path.exists(f):
|
|
for r in csv.DictReader(open(f)):
|
|
ti = arrondi(r["time_utc"])
|
|
if debut <= ti <= fin:
|
|
cam[ti] = r
|
|
jour += timedelta(days=1)
|
|
return rows, cam
|
|
|
|
|
|
def main():
|
|
a = sys.argv[1:]
|
|
debut, fin = t(a[0]), t(a[1])
|
|
cibles = CIBLES
|
|
if "--capteurs" in a:
|
|
cibles = a[a.index("--capteurs") + 1].split(",")
|
|
nom = a[a.index("--nom") + 1] if "--nom" in a else ""
|
|
rows, cam = lire(debut, fin)
|
|
instants = sorted({k[0] for k in rows})
|
|
if "--table" in a:
|
|
refs = sorted({k[1] for k, r in rows.items() if r["pattern_type"] == "global_ref"})
|
|
print("instant " + " ".join(f"{c:>15}" for c in cibles) + " inl tilt")
|
|
for ti in instants:
|
|
cells = []
|
|
for c in cibles:
|
|
r = rows.get((ti, c))
|
|
if r is None:
|
|
cells.append(f"{'-':>15}")
|
|
elif float(r["error_value"]) > float(r["error_threshold"]):
|
|
cells.append(f"{'r':>15}")
|
|
else:
|
|
cells.append(f"{float(r['corr_x']):+7.3f}/{float(r['corr_y']):+7.3f}")
|
|
n = sum(1 for rf in refs if rows.get((ti, rf), {}).get("inlier") == "1.0")
|
|
tl = cam.get(ti, {}).get("median_tilt")
|
|
print(f"{ti:%m-%d %H:%M} " + " ".join(cells) + f" {n:3d} {float(tl):.3f}" if tl else f"{ti:%m-%d %H:%M} " + " ".join(cells) + f" {n:3d} -")
|
|
import matplotlib
|
|
matplotlib.use("Agg")
|
|
import matplotlib.pyplot as plt
|
|
fig, ax = plt.subplots(len(cibles) + 1, 2, figsize=(16, 2.0 * (len(cibles) + 1)), sharex=True)
|
|
for i, c in enumerate(cibles):
|
|
for j, col in enumerate(["corr_x", "corr_y"]):
|
|
xs, ys = [], []
|
|
for ti in instants:
|
|
r = rows.get((ti, c))
|
|
if r and float(r["error_value"]) <= float(r["error_threshold"]) and r[col]:
|
|
xs.append(ti); ys.append(float(r[col]))
|
|
if not ys:
|
|
continue
|
|
s = sorted(ys)
|
|
lo, hi = s[int(0.01 * len(s))], s[int(0.99 * len(s)) - 1]
|
|
m = (hi - lo) * 0.3 + 0.02
|
|
ax[i, j].plot(xs, ys, ".-", ms=2, lw=0.6)
|
|
ax[i, j].set_ylim(lo - m, hi + m)
|
|
ax[i, j].set_title(f"{c} {col}", fontsize=8)
|
|
ax[i, j].grid(alpha=0.3)
|
|
for j, col in enumerate(["median_tilt", "median_rotation"]):
|
|
xs = sorted(cam)
|
|
ax[-1, j].plot(xs, [float(cam[x][col]) for x in xs], ".-", ms=2, lw=0.6, color="g")
|
|
ax[-1, j].set_title(f"caméra {col}", fontsize=8)
|
|
ax[-1, j].grid(alpha=0.3)
|
|
fig.tight_layout()
|
|
p = f"{SORTIE}/serie_{nom}{debut:%m%d%H%M}_{fin:%m%d%H%M}.png"
|
|
fig.savefig(p, dpi=80)
|
|
print(p)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|