Files
aimsight-labeling/auto/analyses/WILDSTRUBEL_2026-09-24T0230_2026-10-06T1945/scripts/clipplot.py
T
maximeandClaude Opus 5.5 ddb17c2189 auto: labels requalified under the 5-noise rules (only what stands out from the noise): 32 analyses refined, the 6 paused periods verified, the long labels requalified with the fixes the period analysts found; 1153 -> 961 labels
- 32 analyses: each label kept, rewritten or removed by its analyst (section Requalification of the report; mm magnitudes where the targets have them)
- SNCF01 x3, WILDSTRUBEL 2026-09-01 -> 2026-10-06 x3: verified from their existing labels under the new rules
- long labels (no analysis): auto/analyses/long-labels/<STATION>/; NORDEND-169 and -195 run to 07/11, so NORDEND-283 and -284 (their continuation) are removed
- reading-rules.md, stations.md: the citations of removed or rewritten labels point to their successor, or to [expert]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 23:58:00 +01:00

43 lines
1.9 KiB
Python

"""corr_x, corr_y of chosen targets, one panel per target and column, y clipped to the 1st-99th percentile.
Usage: .venv/bin/python clipplot.py OUT.png START END SENSORS [--mm] [--labels F]
--labels: grey band per label (family colour), only those longer than 2 h.
"""
import sys, json, statistics
sys.path.insert(0, "tools/scripts")
import data
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
out, a, b, sens = sys.argv[1], data.parse_time(sys.argv[2]), data.parse_time(sys.argv[3]), sys.argv[4].split(",")
mm = "--mm" in sys.argv
by = data.load("data/WILDSTRUBEL")
cols = ("corr_x_mm", "corr_y_mm") if mm else ("corr_x", "corr_y")
fig, axs = plt.subplots(len(sens), 2, figsize=(18, 2.2 * len(sens)), sharex=True, squeeze=False)
labels = []
if "--labels" in sys.argv:
labels = [json.loads(l) for l in open(sys.argv[sys.argv.index("--labels") + 1])]
colors = {"Visibility": "tab:blue", "Obstruction": "tab:orange", "Thermal displacement": "tab:red",
"Displacement": "tab:green", "Target issue": "tab:purple", "No data": "grey"}
for i, s in enumerate(sens):
for j, c in enumerate(cols):
ax = axs[i][j]
ms = [m for m in by[s] if a <= m["t"] <= b and m[c] is not None]
if not ms:
continue
v = sorted(m[c] for m in ms)
lo, hi = v[int(0.01 * len(v))], v[int(0.99 * len(v)) - 1]
pad = 0.15 * (hi - lo)
ax.plot([m["t"] for m in ms], [m[c] for m in ms], ".-", ms=2, lw=0.5)
ax.set_ylim(lo - pad, hi + pad)
ax.set_ylabel(f"{s} {c}", fontsize=8)
ax.grid(alpha=0.3)
for L in labels:
la, lb = data.parse_time(L["start"]), data.parse_time(L["end"])
if (lb - la).total_seconds() > 7200 and lb > a and la < b:
ax.axvspan(max(la, a), min(lb, b), color=colors.get(L["family"], "k"), alpha=0.12)
fig.tight_layout()
fig.savefig(out, dpi=80)
print(out)