Files
aimsight-labeling/auto/analyses/JUNGFRAU_2026-10-10T1615_2026-10-21T1030/scripts/mm_magnitudes.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
1.8 KiB
Python

"""For the report: per label, the largest deviation of each target in mm (corr_x_mm, corr_y_mm), the same three
levels as requalify.py (rolling ±3, hour before, hour after); prints the three largest targets per label.
Usage: python3 <this> data/JUNGFRAU labels.jsonl
"""
import json
import statistics
import sys
from datetime import timedelta
sys.path.insert(0, "tools/scripts")
import data # noqa: E402
folder, labels_path = sys.argv[1:3]
meas = data.load(folder)
for line in open(labels_path):
lab = json.loads(line)
a, b = data.parse_time(lab["start"]), data.parse_time(lab["end"])
best = []
for name, ms in meas.items():
if data.is_reference(ms):
continue
for col in ("corr_x_mm", "corr_y_mm"):
pts = [(m["t"], m[col]) for m in ms if a - timedelta(hours=2) <= m["t"] <= b + timedelta(hours=2)
and not data.rejected(m) and m[col] is not None]
pre = [v for t, v in pts if a - timedelta(hours=1) <= t <= a]
post = [v for t, v in pts if b <= t <= b + timedelta(hours=1)]
levels = [statistics.median(x) for x in (pre, post) if x]
top = (0.0, "")
for i, (t, v) in enumerate(pts):
if not (a < t.replace(second=0, microsecond=0) < b):
continue
nb = [w for _, w in pts[max(0, i - 3):i]] + [w for _, w in pts[i + 1:i + 4]]
lv = list(levels) + ([statistics.median(nb)] if nb else [])
for lvl in lv:
if abs(v - lvl) > abs(top[0]):
top = (v - lvl, data.iso(t))
if top[1]:
best.append((abs(top[0]), f"{name} {col[5]} {top[0]:+.1f} mm at {top[1][11:16]}"))
best.sort(reverse=True)
print(lab.get("id", "?"), lab["start"], lab["family"][:10], " | ".join(s for _, s in best[:3]))