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

28 lines
1.4 KiB
Python

"""For each label, the target ranges (k5) of ranges.py output that overlap its touched points."""
import json, re, sys
from datetime import datetime, timedelta
labels_f, *rfiles = sys.argv[1:]
P = lambda s: datetime.strptime(s, "%Y-%m-%dT%H:%MZ")
rx = re.compile(r"^(\S+?)\s*(\d{4}-\d\d-\d\dT\d\d:\d\dZ)\s+(\S+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)")
for rf in rfiles:
col = None; R = []
for line in open(rf):
m = re.match(r"^(corr_[xy]): ranges", line)
if m: col = m.group(1); continue
if line.startswith("==") : col = None
m = rx.match(line)
if col and m:
s, a, b, n, v, k, at = m.groups()
if "REF" in s: continue
R.append((s, col, P(a), P(b), int(n), float(k), at))
print("#####", rf)
for l in map(json.loads, open(labels_f)):
a, b = P(l["start"]), P(l["end"])
# touched: strictly inside, plus start if label is 1h long (gap edge)
lo = a if b - a <= timedelta(hours=1) else a + timedelta(hours=1)
hi = b - timedelta(hours=1) if b - a > timedelta(hours=1) else a
hits = [r for r in R if r[2] <= hi and r[3] >= lo]
best = sorted(hits, key=lambda r: -abs(r[5]))[:6]
print(f"{l['id']:15s} {l['start']}→{l['end'][11:]} {l['family'][:12]:12s} n={len(hits):3d} " +
"; ".join(f"{s[-11:] if s.startswith('PWD') else s} {c[-1]} {k:+.1f}@{at[8:13]}" for s,c,_,_,_,k,at in best))