- 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>
80 lines
4.3 KiB
Python
80 lines
4.3 KiB
Python
"""Per day: what each target's corr keeps of the morning camera wave, at clean instants, against a rest level.
|
|
|
|
Rest level: median of the accepted clean measurements of the night before (D-1 17:00 -> D 04:00) when it has >= 8,
|
|
else of the evening of D (15:45 -> 21:00), else of its afternoon (12:45 -> 15:45, then compared up to it). Clean instant: all references retained except R3 (and the usual
|
|
rejections of R3 only), not strictly inside a brief label (<= 90 min) of LABELS. Raw deviation in own noises
|
|
(median |diff| over the range). Per target and column: max |raw dev| with instant, the longest run of
|
|
consecutive clean points beyond K on the same side (start-end, n), and the error_value of the target by day vs
|
|
by night (medians), to compare the targets.
|
|
Usage: python3 thermal.py LABELS.jsonl [--k 5] [--day 2026-09-29]
|
|
"""
|
|
import json, sys, statistics
|
|
from datetime import timedelta
|
|
sys.path.insert(0, "tools/scripts")
|
|
import data
|
|
|
|
K = float(sys.argv[sys.argv.index("--k") + 1]) if "--k" in sys.argv else 5
|
|
S, E = data.parse_time("2026-09-24T02:30Z"), data.parse_time("2026-10-06T19:45Z")
|
|
by = data.load("data/WILDSTRUBEL")
|
|
for _ms in by.values(): # measurement instants to the minute, as the label bounds
|
|
for _m in _ms:
|
|
_m["t"] = _m["t"].replace(second=0, microsecond=0)
|
|
refs = [s for s, ms in by.items() if data.is_reference(ms)]
|
|
tg = sorted(s for s, ms in by.items() if not data.is_reference(ms))
|
|
excl = []
|
|
for l in open(sys.argv[1]):
|
|
L = json.loads(l)
|
|
a, b = data.parse_time(L["start"]), data.parse_time(L["end"])
|
|
if b - a <= timedelta(minutes=90):
|
|
excl.append((a, b))
|
|
bad = set()
|
|
for r in refs:
|
|
if r == "R3":
|
|
continue
|
|
for m in by[r]:
|
|
if data.rejected(m) or m.get("inlier") == 0:
|
|
bad.add(m["t"])
|
|
clean = lambda t: t not in bad and not any(a < t < b for a, b in excl)
|
|
noise = {}
|
|
for s in tg:
|
|
for c in ("corr_x", "corr_y"):
|
|
v = [m[c] for m in by[s] if S <= m["t"] <= E and m[c] is not None]
|
|
noise[s, c] = statistics.median(abs(b - a) for a, b in zip(v, v[1:]))
|
|
days = [data.parse_time(sys.argv[sys.argv.index("--day") + 1] + "T00:00Z")] if "--day" in sys.argv else \
|
|
[data.parse_time("2026-09-24T00:00Z") + timedelta(days=i) for i in range(13)]
|
|
for day in days:
|
|
print(f"=== {day:%m-%d}")
|
|
for s in tg:
|
|
ms = by[s]
|
|
ev_d = [m["error_value"] for m in ms if day + timedelta(hours=6) <= m["t"] < day + timedelta(hours=14) and m["error_value"] is not None]
|
|
ev_n = [m["error_value"] for m in ms if day - timedelta(hours=4) <= m["t"] < day + timedelta(hours=3) and m["error_value"] is not None]
|
|
for c in ("corr_x", "corr_y"):
|
|
nz = noise[s, c]
|
|
acc = [m for m in ms if m[c] is not None and clean(m["t"])]
|
|
night = [m[c] for m in acc if day - timedelta(hours=7) <= m["t"] < day + timedelta(hours=4)]
|
|
src = "night"
|
|
if len(night) < 8:
|
|
night = [m[c] for m in acc if day + timedelta(hours=15, minutes=45) <= m["t"] <= day + timedelta(hours=21)]
|
|
src = "eve"
|
|
if len(night) < 4:
|
|
night = [m[c] for m in acc if day + timedelta(hours=12, minutes=45) <= m["t"] <= day + timedelta(hours=15, minutes=45)]
|
|
src = "aft"
|
|
if len(night) < 4:
|
|
print(f" {s:6s}{c[-1]} no rest level"); continue
|
|
lvl = statistics.median(night)
|
|
ser = [(m["t"], (m[c] - lvl) / nz) for m in acc if day + timedelta(hours=4) <= m["t"] < day + timedelta(hours=15, minutes=45)]
|
|
if not ser:
|
|
continue
|
|
mx = max(ser, key=lambda x: abs(x[1]))
|
|
best, cur = (0, None, None), []
|
|
for t, d in ser:
|
|
if abs(d) > K and (not cur or (d > 0) == (cur[-1][1] > 0)):
|
|
cur.append((t, d))
|
|
else:
|
|
cur = [(t, d)] if abs(d) > K else []
|
|
if len(cur) > best[0]:
|
|
best = (len(cur), cur[0][0], cur[-1][0])
|
|
run = f"run {best[0]:2d} {best[1]:%H:%M}-{best[2]:%H:%M}" if best[0] else "run 0"
|
|
evs = f"ev day {statistics.median(ev_d):.2f} night {statistics.median(ev_n):.2f}" if ev_d and ev_n else ""
|
|
print(f" {s:6s}{c[-1]} [{src:5s}] max {mx[1]:+6.1f} @{mx[0]:%H:%M} {run:22s} n={len(ser):2d} {evs if c == 'corr_x' else ''}")
|