Etiqueteur: October labels for 8 stations; its folder moves to labeling/auto/etiqueteur/, analyses and scripts versioned (D-126)
Labels for CLARIDEN, FLORIDA, JUNGFRAU (gaps 06-20.10, 26.10-01.11), LENZSPITZE, NIEDERHORN, NORDEND, SNCF01, WILDSTRUBEL. Figures and tool outputs stay out of git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2bba388290
commit
6fbd7510b7
112 files changed
+8951
-6
No files matched your search
@@ -0,0 +1,85 @@
|
||||
"""Figure d'un intervalle : corr_x, corr_y des cibles (écrêtés), error_value, tilt, nb de références retenues.
|
||||
Usage : .venv/bin/python <ce script> DEBUT FIN [clip] [cibles] (DEBUT/FIN : AAAA-MM-JJTHH:MM)
|
||||
Imprime aussi la table des mesures (cibles acceptées) avec les références hors compensation."""
|
||||
import csv, glob, sys, os
|
||||
from datetime import datetime, timezone
|
||||
import matplotlib
|
||||
matplotlib.use("Agg")
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
D = "data/WILDSTRUBEL"
|
||||
OUT = "labeling/auto/etiqueteur/WILDSTRUBEL_2026-10-01"
|
||||
deb, fin = sys.argv[1], sys.argv[2]
|
||||
clip = float(sys.argv[3]) if len(sys.argv) > 3 else 0.8
|
||||
CIB = (sys.argv[4].split(",") if len(sys.argv) > 4 else
|
||||
["PA2_2", "PA3_2", "PA_9", "PB1_2", "PB2_2", "PB4", "PB_5"])
|
||||
REFS = ["PA1_2", "PA_8", "PB3_2", "R1", "R2", "R3"]
|
||||
|
||||
def t(s):
|
||||
return datetime.fromisoformat(s.replace(" ", "T")[:16] + "+00:00")
|
||||
|
||||
T0, T1 = t(deb), t(fin)
|
||||
rows = []
|
||||
for f in sorted(glob.glob(f"{D}/displacement/WILDSTRUBEL_advanced_*.csv")):
|
||||
for r in csv.DictReader(open(f)):
|
||||
tt = t(r["time_utc"])
|
||||
if T0 <= tt <= T1:
|
||||
r["t"] = tt
|
||||
rows.append(r)
|
||||
cam = {}
|
||||
for f in sorted(glob.glob(f"{D}/camera/WILDSTRUBEL_camera_*.csv")):
|
||||
for r in csv.DictReader(open(f)):
|
||||
tt = t(r["time_utc"])
|
||||
if T0 <= tt <= T1:
|
||||
cam[tt] = float(r["median_tilt"])
|
||||
|
||||
def fl(v):
|
||||
try:
|
||||
return float(v)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
ser = {}
|
||||
inst = {}
|
||||
for r in rows:
|
||||
s = r["sensor_name"]
|
||||
ev, th = fl(r["error_value"]), fl(r["error_threshold"])
|
||||
rej = ev is not None and th is not None and ev > th
|
||||
inst.setdefault(r["t"], {})[s] = (r, rej)
|
||||
if s in CIB:
|
||||
cx, cy = (None, None) if rej else (fl(r["corr_x"]), fl(r["corr_y"]))
|
||||
ser.setdefault(s, []).append((r["t"], cx, cy, ev))
|
||||
|
||||
fig, ax = plt.subplots(5, 1, figsize=(15, 13), sharex=True)
|
||||
for s in CIB:
|
||||
L = sorted(ser.get(s, []))
|
||||
ts = [a[0] for a in L]
|
||||
for i, k in ((0, 1), (1, 2)):
|
||||
ax[i].plot(ts, [None if a[k] is None else max(-clip, min(clip, a[k])) for a in L], ".-", ms=3, lw=0.8, label=s)
|
||||
ax[2].plot(ts, [a[3] for a in L], ".-", ms=3, lw=0.8, label=s)
|
||||
ax[0].set_ylabel(f"corr_x (écrêté ±{clip})"); ax[1].set_ylabel("corr_y"); ax[2].set_ylabel("error_value cibles")
|
||||
ax[0].legend(fontsize=7, ncol=7)
|
||||
ct = sorted(cam)
|
||||
ax[3].plot(ct, [cam[k] for k in ct], ".-g", ms=3); ax[3].set_ylabel("tilt caméra")
|
||||
ts = sorted(inst)
|
||||
nret = [sum(1 for s in REFS if s in inst[k] and inst[k][s][0]["inlier"] == "1.0") for k in ts]
|
||||
ax[4].step(ts, nret, where="mid"); ax[4].set_ylabel("réf. retenues")
|
||||
for a in ax:
|
||||
a.grid(alpha=.3)
|
||||
fig.tight_layout()
|
||||
p = f"{OUT}/jour_{deb[:13].replace(':','')}_{fin[:13].replace(':','')}.png"
|
||||
fig.savefig(p, dpi=80)
|
||||
print(p)
|
||||
print("instant " + " ".join(f"{s:>13}" for s in CIB) + " hors_compensation")
|
||||
for k in ts:
|
||||
cells = []
|
||||
for s in CIB:
|
||||
r, rej = inst[k].get(s, (None, True))
|
||||
if r is None:
|
||||
cells.append(f"{'-':>13}")
|
||||
elif rej:
|
||||
cells.append(f"{'rej':>13}")
|
||||
else:
|
||||
cells.append(f"{'vide':>13}" if r['corr_x'] == '' else f"{float(r['corr_x']):+6.2f}/{float(r['corr_y']):+6.2f}")
|
||||
hors = [s + ("r" if inst[k][s][1] else "0") for s in REFS if s in inst[k] and inst[k][s][0]["inlier"] != "1.0"]
|
||||
print(k.strftime("%m-%dT%H:%M") + " " + " ".join(cells) + " " + ",".join(hors))
|
||||
Reference in new issue
Block a user