auto: the analysts verified the labels of 32 periods (11 stations, up to 14 days each): 710 labels -> 835, 587 unchanged; one analysis folder per period with its report (section Verification)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-17 15:13:44 +01:00
1 parent df979301b5
commit 2a5d87659b
279 files changed
+10758 -710

No files matched your search

@@ -0,0 +1,52 @@
"""Per-instant dump on a window: pose, temperature, and per sensor the deviation of corr_x, corr_y, error_value
from its level over a base window (median), in noises (median abs diff between consecutive measurements over base).
Usage: dump.py START END BASE_START BASE_END [k] [sensors]"""
import sys, statistics
sys.path.insert(0, "tools/scripts")
import data
F = "data/CLARIDEN"
start, end, b0, b1 = (data.parse_time(a) for a in sys.argv[1:5])
k = float(sys.argv[5]) if len(sys.argv) > 5 else 4
only = sys.argv[6].split(",") if len(sys.argv) > 6 else None
M = data.load(F)
cam = {p["t"].replace(second=0, microsecond=0): p for p in data.load_camera(F)}
temp = data.load_temperature(F)
lvl = {}
for s, ms in M.items():
base = [m for m in ms if b0 <= m["t"] <= b1]
for c in ("corr_x", "corr_y", "error_value"):
v = [m[c] for m in base if m[c] is not None]
if len(v) < 4:
continue
d = [abs(a - b) for a, b in zip(v, v[1:])]
lvl[(s, c)] = (statistics.median(v), max(statistics.median(d), 1e-4))
times = sorted({m["t"] for ms in M.values() for m in ms if start <= m["t"] <= end})
for t in times:
tm = t.replace(second=0, microsecond=0)
p = cam.get(tm, {})
tt = [v for (u, v) in temp if abs((u - t).total_seconds()) <= 1800]
out = []
for s, ms in sorted(M.items()):
if only and s not in only:
continue
m = next((m for m in ms if m["t"] == t), None)
if m is None:
continue
if data.rejected(m):
out.append(f"{s}:REJ")
continue
parts = []
for c, n in (("corr_x", "x"), ("corr_y", "y"), ("error_value", "e")):
if (s, c) in lvl and m[c] is not None:
L, N = lvl[(s, c)]
z = (m[c] - L) / N
if abs(z) >= k or only:
parts.append(f"{n}{z:+.0f}")
if parts:
out.append(s + ":" + ",".join(parts))
sc = p.get("scale")
print(data.iso(t), f"T={tt[0]:.2f}" if tt else "T=-",
f"sc={(sc-1)*1e5:+.1f}e-5" if sc else "sc=-",
f"tl={p.get('tilt') or 0:+.4f} pn={p.get('pan') or 0:+.4f} rt={p.get('rotation') or 0:+.4f}",
f"n={len(out)}", " ".join(out))
@@ -0,0 +1,26 @@
"""Rolling median (N measurements centred) of one column of chosen sensors, printed every `every` measurements.
Usage: smooth.py START END COLUMN SENSORS [N] [every]"""
import sys, statistics
sys.path.insert(0, "tools/scripts")
import data
start, end = data.parse_time(sys.argv[1]), data.parse_time(sys.argv[2])
col, sensors = sys.argv[3], sys.argv[4].split(",")
N = int(sys.argv[5]) if len(sys.argv) > 5 else 7
every = int(sys.argv[6]) if len(sys.argv) > 6 else 6
M = data.load("data/CLARIDEN")
series = {}
for s in sensors:
ms = [m for m in M[s] if start <= m["t"] <= end]
series[s] = {m["t"]: m[col] for m in ms}
times = sorted(set().union(*[set(v) for v in series.values()]))
print("time", *sensors, sep="\t")
for i, t in enumerate(times):
if i % every:
continue
row = []
for s in sensors:
w = [series[s].get(u) for u in times[max(0, i - N // 2): i + N // 2 + 1]]
w = [x for x in w if x is not None]
row.append(f"{statistics.median(w):+.3f}" if w else "-")
print(data.iso(t), *row, sep="\t")
@@ -0,0 +1,39 @@
"""Figure: D-303-B corrected vertical curve against the camera tilt, 5 to 11 October (hourly medians).
Usage: .venv/bin/python tilt_fig.py OUT.png"""
import sys, statistics
from collections import defaultdict
sys.path.insert(0, "tools/scripts")
import data
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
p = data.parse_time
t0, t1 = p("2026-10-05T11:00Z"), p("2026-10-11T00:00Z")
M = data.load("data/CLARIDEN")
P = data.load_camera("data/CLARIDEN")
def hourly(pairs):
h = defaultdict(list)
for t, v in pairs:
h[t.replace(minute=0, second=0, microsecond=0)].append(v)
return sorted((k, statistics.median(v)) for k, v in h.items())
tilt = hourly([(q["t"], q["tilt"]) for q in P if t0 <= q["t"] <= t1 and q["tilt"] is not None])
cy = hourly([(m["t"], m["corr_y"]) for m in M["D-303-B"] if t0 <= m["t"] <= t1 and m["corr_y"] is not None])
fig, ax = plt.subplots(figsize=(11, 4))
ax.plot([t for t, _ in cy], [v for _, v in cy], color="tab:blue", label="D-303-B corrected vertical [px]")
ax.set_ylabel("D-303-B corrected vertical [px]", color="tab:blue")
ax2 = ax.twinx()
ax2.plot([t for t, _ in tilt], [v for _, v in tilt], color="tab:red", label="camera tilt [deg] (axis reversed)")
ax2.invert_yaxis()
ax2.set_ylabel("camera tilt [deg], reversed", color="tab:red")
for a, b in [("2026-10-06T13:00Z", "2026-10-06T13:30Z"), ("2026-10-08T08:50Z", "2026-10-08T09:10Z")]:
ax.axvspan(p(a), p(b), color="grey", alpha=0.3)
ax.set_title("CLARIDEN: D-303-B follows the camera tilt (hourly medians, UTC); grey: the two tilt steps")
fig.autofmt_xdate()
fig.tight_layout()
fig.savefig(sys.argv[1], dpi=90)
print(sys.argv[1])