Files
aimsight-labeling/auto/analyses/NIEDERHORN_2026-10-01T0000_2026-10-11T0500/scripts/maxdev.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

42 lines
2.1 KiB
Python

"""Max deviation in own noises, over the touched points of given labels, all targets, corr_x/corr_y,
level = window median (global) or median of 6 neighbours each side (rolling), as ranges.py does."""
import json, sys, statistics
sys.path.insert(0, "tools/scripts")
from datetime import timedelta
from data import load, filter_window, parse_time, is_reference, iso, rejected
from common import own_noise
folder, labels_f, ids = sys.argv[1], sys.argv[2], sys.argv[3].split(",")
by = load(folder)
W0, W1 = parse_time("2026-10-01T00:00Z"), parse_time("2026-10-11T05:00Z")
R0 = parse_time("2026-09-30T12:00Z")
def stats(s, col, w0):
ms = [(m["t"], m[col]) for m in filter_window(by[s], w0, W1) if m[col] is not None]
if len(ms) < 2: return None
return ms, statistics.median(v for _, v in ms), own_noise([v for _, v in ms])
def roll(ms, i, g=6):
w = [v for _, v in ms[max(0, i-g):i] + ms[i+1:i+g+1]]
return statistics.median(w)
for l in map(json.loads, open(labels_f)):
if l["id"] not in ids: continue
a, b = parse_time(l["start"]), parse_time(l["end"])
lo, hi = (a, a) if b - a <= timedelta(hours=1) else (a + timedelta(hours=1), b - timedelta(hours=1))
out = {"global": [], "rolling": []}
rej = set()
for s in by:
if is_reference(by[s]): continue
for m in filter_window(by[s], lo, hi):
if rejected(m): rej.add(s)
for col in ("corr_x", "corr_y"):
for mode, w0 in (("global", W0), ("rolling", R0)):
st = stats(s, col, w0)
if not st or not st[2]: continue
ms, lvl, nz = st
for i, (t, v) in enumerate(ms):
if iso(lo) <= iso(t) <= iso(hi):
ref = lvl if mode == "global" else roll(ms, i)
out[mode].append(((v - ref) / nz, s, col[-1], iso(t)[8:16]))
print(f"{l['id']} {l['start']}→{l['end']} touched {iso(lo)}..{iso(hi)} rejected: {','.join(sorted(rej)) or '-'}")
for mode in out:
top = sorted(out[mode], key=lambda x: -abs(x[0]))[:4]
print(f" {mode:8s} " + "; ".join(f"{s} {c} {d:+.1f}@{t}" for d, s, c, t in top))