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>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-17 23:58:00 +01:00
1 parent c779de7720
commit ddb17c2189
321 files changed
+18464 -3426

No files matched your search

@@ -0,0 +1,28 @@
"""Requalification spot checks: rolling(±3) deviation in own noises of chosen sensors at chosen instants; rejection
counts; sensors present at the No data instants. usage: python3 checks.py"""
import sys, statistics
sys.path.insert(0, 'tools/scripts')
import data
M = data.load('data/NIEDERHORN')
a0, a1 = data.parse_time('2026-10-21T12:00Z'), data.parse_time('2026-11-01T00:00Z')
def win(s): return [m for m in M[s] if a0 <= m['t'] <= a1]
def noise(vals): # median absolute step / robust, same idea as the tools: use MAD of first differences
d = [abs(b - a) for a, b in zip(vals, vals[1:])]
return statistics.median(d) / 0.6745 / 2 ** 0.5 * 1.0
def dev(s, t, c):
ms = [m for m in win(s) if m[c] is not None]
ts = [data.iso(m['t'])[:16] for m in ms]
if t not in ts: return 'rejected/missing'
i = ts.index(t)
nb = [m[c] for m in ms[max(0, i-3):i] + ms[i+1:i+4]]
return f"{(ms[i][c] - statistics.median(nb)):+.4f} px"
for s, t in [('PWD_IMP_B07_016_C09', '2026-10-28T04:00'), ('PWD_IMP_B07_016_C09', '2026-10-26T13:00'),
('PWD_RMP_B15_017_C09', '2026-10-29T13:00'), ('PWD_RMP_B15_017_C09', '2026-10-26T13:00'),
('e01', '2026-10-24T18:00'), ('PWD_IMP_B07_017_C09', '2026-10-22T16:00')]:
print(s, t, 'cx', dev(s, t, 'corr_x'), 'cy', dev(s, t, 'corr_y'))
for s, x, y in [('e10', '2026-10-30T04:00Z', '2026-11-01T00:00Z'), ('PWD_RMP_B16_026_C09', '2026-10-30T02:00Z', '2026-11-01T00:00Z'),
('e10', '2026-10-21T12:00Z', '2026-10-30T01:00Z')]:
ms = [m for m in M[s] if data.parse_time(x) <= m['t'] < data.parse_time(y)]
print(s, x, y, 'rejected', sum(data.rejected(m) for m in ms), 'of', len(ms))
for t in ['2026-10-23T00:00', '2026-10-26T15:00', '2026-10-28T12:00']:
print(t, 'sensors with a reading:', sum(1 for s in M for m in M[s] if data.iso(m['t'])[:16] == t))
@@ -0,0 +1,96 @@
"""Requalification: for each label, the largest deviation in own noises of a target on corr_x / corr_y
inside the label (start < t < end), read from ranges.py outputs (k 5, plain and rolling),
and for thermal labels the deviation from the preceding night level (01:00-11:00 UTC of the start day).
usage: python3 requal.py <analysis folder>"""
import json, re, sys, statistics
sys.path.insert(0, 'tools/scripts')
import data
D = sys.argv[1]
W = D + '/work/requal/'
LINE = re.compile(r'^(\S+?)(\d{4}-\d\d-\d\dT\d\d:\d\dZ)\s+(\S+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d+)')
def parse(path):
out, noise, col, mode = [], {}, None, None
for ln in open(path):
if ln.startswith('== '):
col, mode = ln.split()[1].rstrip(':'), 'noise'
continue
if 'ranges more than' in ln:
col, mode = ln.split(':')[0], 'ranges'
continue
if mode == 'noise':
p = ln.split()
if len(p) >= 4 and p[0] not in ('sensor',):
try:
noise[(p[0][:len(p[0])], col)] = float(p[3]) if len(p) > 4 else None
except ValueError:
pass
if mode == 'ranges':
m = LINE.match(ln.rstrip())
if m:
s, a, b, n, ext, kn, at, rej = m.groups()
out.append(dict(sensor=s, col=col, a=a, b=b, noises=float(kn), at=at))
return out, noise
def overlaps(r, lab):
return r['a'] < lab['end'] and r['b'] > lab['start']
plain, _ = parse(W + 'ranges_k5.txt')
roll, _ = parse(W + 'ranges_k5_roll3.txt')
refs = lambda s: 'REF' in s
# noises from ranges output (plain)
noise = {}
col = None
for ln in open(W + 'ranges_k5.txt'):
if ln.startswith('== '):
col = ln.split()[1].rstrip(':')
continue
if 'ranges more' in ln:
col = None
if col:
p = ln.split()
if len(p) >= 5 and p[0] != 'sensor' and p[1].isdigit():
try:
noise[(p[0], col)] = float(p[3])
except ValueError:
pass
M = data.load('data/NIEDERHORN')
labels = [json.loads(l) for l in open(D + '/work/requalify_input.jsonl')]
for lab in labels:
def best(rs):
rs = [r for r in rs if not refs(r['sensor']) and overlaps(r, lab)]
rs = [r for r in rs if lab['start'] < r['at'] < lab['end']]
if not rs:
return '-'
r = max(rs, key=lambda r: abs(r['noises']))
return f"{r['sensor']} {r['col']} {r['noises']:+.1f} at {r['at'][5:16]} ({len(rs)} ranges)"
line = f"{lab['id']:15s} {lab['start'][5:16]}→{lab['end'][5:16]} {lab['family'][:12]:12s} plain: {best(plain)} | roll3: {best(roll)}"
if lab['family'] == 'Thermal displacement':
day = lab['start'][:10]
n0, n1 = data.parse_time(day + 'T01:00Z'), data.parse_time(day + 'T11:00Z')
a, b = data.parse_time(lab['start']), data.parse_time(lab['end'])
top = (0, '')
for s, ms in M.items():
if data.is_reference(ms):
continue
for c in ('corr_x', 'corr_y'):
nz = noise.get((s, c))
if not nz:
continue
night = [m[c] for m in ms if n0 <= m['t'] <= n1 and m[c] is not None and not data.rejected(m)]
if len(night) < 4:
continue
lvl = statistics.median(night)
for m in ms:
if a < m['t'] < b and m[c] is not None and not data.rejected(m):
d = (m[c] - lvl) / nz
if abs(d) > abs(top[0]):
top = (d, f"{s} {c} at {data.iso(m['t'])[5:16]}")
line += f" | night: {top[1]} {top[0]:+.1f}"
print(line)
@@ -0,0 +1,43 @@
"""Thermal labels: deviation from the preceding night level (01:00-11:00 UTC) of the median of 3 consecutive accepted
measurements (removes single-measurement spikes: trains, plant), in own noises (noise of ranges_k5.txt).
usage: python3 thermal3.py <analysis folder>"""
import json, sys, statistics
sys.path.insert(0, 'tools/scripts')
import data
D = sys.argv[1]
noise, col = {}, None
for ln in open(D + '/work/requal/ranges_k5.txt'):
if ln.startswith('== '):
col = ln.split()[1].rstrip(':'); continue
if 'ranges more' in ln: col = None
if col:
p = ln.split()
if len(p) >= 5 and p[1].isdigit():
try: noise[(p[0], col)] = float(p[3])
except ValueError: pass
M = data.load('data/NIEDERHORN')
for lab in map(json.loads, open(D + '/work/requalify_input.jsonl')):
if lab['family'] != 'Thermal displacement': continue
day = lab['start'][:10]
n0, n1 = data.parse_time(day + 'T01:00Z'), data.parse_time(day + 'T11:00Z')
a, b = data.parse_time(lab['start']), data.parse_time(lab['end'])
res = []
for s, ms in M.items():
if data.is_reference(ms): continue
for c in ('corr_x', 'corr_y'):
nz = noise.get((s, c))
if not nz: continue
night = [m[c] for m in ms if n0 <= m['t'] <= n1 and m[c] is not None]
if len(night) < 4: continue
lvl = statistics.median(night)
pts = [m for m in ms if a < m['t'] < b and m[c] is not None]
for i in range(1, len(pts) - 1):
v = statistics.median(p[c] for p in pts[i-1:i+2])
res.append(((v - lvl) / nz, s, c, data.iso(pts[i]['t'])[5:16]))
res.sort(key=lambda r: -abs(r[0]))
seen, top = set(), []
for r in res:
if r[1] not in seen:
seen.add(r[1]); top.append(f'{r[1]} {r[2]} {r[0]:+.1f} at {r[3]}')
if len(top) == 4: break
print(lab['id'], lab['start'][5:16], '; '.join(top))