- 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>
56 lines
2.7 KiB
Python
56 lines
2.7 KiB
Python
"""Per day and per target: fast deviation (rolling ±4 median) and slow deviation (smoothed 5, against the previous
|
|
night level 20-03 UTC), in own noises (median |diff| over the window), with the instants of the extremes.
|
|
Usage: python3 daily.py data/SNCF01 START END [exclude_instants_comma]"""
|
|
import sys, statistics
|
|
from datetime import timedelta
|
|
sys.path.insert(0, "tools/scripts")
|
|
import data, common
|
|
|
|
folder, start, end = sys.argv[1], data.parse_time(sys.argv[2]), data.parse_time(sys.argv[3])
|
|
excl = set(sys.argv[4].split(",")) if len(sys.argv) > 4 else set()
|
|
by = data.load(folder)
|
|
SKIP = {"BG.1", "F4.1"}
|
|
out = []
|
|
for s, ms in by.items():
|
|
if data.is_reference(ms) or s in SKIP:
|
|
continue
|
|
for col in ("corr_x", "corr_y"):
|
|
ser = [(m["t"], m[col]) for m in ms if start - timedelta(hours=12) <= m["t"] <= end and m[col] is not None
|
|
and data.iso(m["t"]) not in excl]
|
|
win = [v for t, v in ser if t >= start]
|
|
if len(win) < 10:
|
|
continue
|
|
noise = common.own_noise(win)
|
|
if not noise:
|
|
continue
|
|
vals = [v for _, v in ser]
|
|
days = {}
|
|
for i, (t, v) in enumerate(ser):
|
|
if t < start:
|
|
continue
|
|
nb = vals[max(0, i - 4):i] + vals[i + 1:i + 5]
|
|
fast = (v - statistics.median(nb)) / noise if nb else 0
|
|
sm = statistics.median(vals[max(0, i - 2):i + 3])
|
|
d = t.date()
|
|
days.setdefault(d, []).append((t, fast, sm))
|
|
# night level: 20-03 before each day
|
|
for d, rows in sorted(days.items()):
|
|
n0 = [v for t, v in ser if (t.date() == d - timedelta(days=1) and t.hour >= 20) or (t.date() == d and t.hour < 3)]
|
|
lvl = statistics.median(n0) if n0 else None
|
|
fmax = max(rows, key=lambda r: abs(r[1]))
|
|
nfast = sum(1 for r in rows if abs(r[1]) > 5)
|
|
if lvl is not None:
|
|
smax = max(rows, key=lambda r: abs(r[2] - lvl))
|
|
sdev = (smax[2] - lvl) / noise
|
|
exc = [r[0] for r in rows if abs(r[2] - lvl) / noise > 5]
|
|
else:
|
|
smax, sdev, exc = (None,), 0, []
|
|
out.append((str(d), s, col, noise, fmax[1], data.iso(fmax[0])[11:16], nfast, sdev,
|
|
data.iso(smax[0])[11:16] if smax[0] else "-",
|
|
data.iso(exc[0])[11:16] if exc else "-", data.iso(exc[-1])[11:16] if exc else "-",
|
|
(data.load_targets(folder).get(s) or {}).get("mm_per_px")))
|
|
for r in sorted(out):
|
|
k = r[11] or 0
|
|
print(f"{r[0]} {r[1]:6} {r[2]:6} noise {r[3]:.4f} ({r[3]*k:.3f}mm) fastmax {r[4]:+6.1f}@{r[5]} n>5 {r[6]:3d} "
|
|
f"slow {r[7]:+6.1f}@{r[8]} ({r[7]*r[3]*k:+.2f}mm) exc {r[9]}-{r[10]}")
|