Files
aimsight-labeling/auto/analyses/SNCF01_2026-10-22T1030_2026-11-01T0000/scripts/agitation.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

32 lines
1.6 KiB
Python

"""Per day and per target: max |corr - rolling median (+-4 meas, without it)| in own noises, split day (07-17 UTC) / night,
and the count of exceedances > 5 noises. Accepted measurements only; skips the four train instants given."""
import sys, statistics
sys.path.insert(0, "tools/scripts")
import data
W0, W1 = data.parse_time("2026-10-22T10:30Z"), data.parse_time("2026-11-01T00:00Z")
skip = {data.parse_time(x) for x in sys.argv[1].split(",")} if len(sys.argv) > 1 else set()
by = data.load("data/SNCF01")
out = {}
for s, ms in by.items():
if ms[0]["pattern_type"] == "global_ref":
continue
for c in ("corr_x", "corr_y"):
pts = [(m["t"].replace(second=0, microsecond=0), m[c]) for m in ms if W0 <= m["t"] <= W1 and m[c] is not None]
pts = [p for p in pts if p[0] not in skip]
if len(pts) < 50: continue
v = [p[1] for p in pts]
noise = statistics.median(abs(b - a) for a, b in zip(v, v[1:]))
for i, (t, x) in enumerate(pts):
nb = v[max(0, i-4):i] + v[i+1:i+5]
dev = (x - statistics.median(nb)) / noise
part = "day" if 7 <= t.hour < 17 else "night"
key = (t.strftime("%m-%d"), part)
o = out.setdefault(key, {})
mx, n = o.get(s, (0, 0))
o[s] = (max(mx, abs(dev)), n + (abs(dev) > 5))
for key in sorted(out):
o = out[key]
tops = sorted(o.items(), key=lambda kv: -kv[1][1])[:6]
tot = sum(n for _, (m, n) in o.items())
print(key[0], key[1].ljust(5), "exceed>5:", str(tot).rjust(3), " ", ", ".join(f"{s} {n}x max{m:.0f}" for s, (m, n) in tops if n))