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,24 @@
"""Hourly median of chosen target columns, in own noises, relative to a level window. usage: start end lvl_start lvl_end sensor:col ..."""
import sys, statistics
from datetime import timedelta
sys.path.insert(0, 'tools/scripts')
from data import load, parse_time
from common import own_noise
s, e, l0, l1 = map(parse_time, sys.argv[1:5])
by = load('data/LENZSPITZE')
specs = [a.split(':') for a in sys.argv[5:]]
B0, B1 = parse_time('2026-10-23T23:55Z'), parse_time('2026-11-01T11:40Z')
cols = []
for name, c in specs:
ms = by[name]
noise = own_noise([m[c] for m in ms if B0 <= m['t'] <= B1 and m[c] is not None])
lvl = statistics.median([m[c] for m in ms if l0 <= m['t'] < l1 and m[c] is not None])
cols.append((name, c, ms, noise, lvl))
print('hour ' + ' '.join(f"{n}{c[-1]:>1}".rjust(8) for n, c, *_ in cols))
h = s
while h < e:
row = []
for n, c, ms, noise, lvl in cols:
v = [m[c] for m in ms if h <= m['t'] < h + timedelta(hours=1) and m[c] is not None]
row.append(f"{(statistics.median(v)-lvl)/noise:8.1f}" if len(v) >= 4 else ' -')
print(f"{h:%m-%d %H}h " + ' '.join(row)); h += timedelta(hours=1)
@@ -0,0 +1,24 @@
"""Deviation of every target (corr_x, corr_y) from the median of its ±12 neighbours, in its batch noise, at given instants;
the 6 largest, and rejected sensors. usage: requal_instant.py T1 T2 ..."""
import sys, statistics
sys.path.insert(0, 'tools/scripts')
from data import load, parse_time, is_reference, rejected
from common import own_noise
B0, B1 = parse_time('2026-10-23T23:55Z'), parse_time('2026-11-01T11:40Z')
by = load('data/LENZSPITZE')
for T in sys.argv[1:]:
t = parse_time(T); devs = []; rej = []
for s, ms in by.items():
ms = [m for m in ms if B0 <= m['t'] <= B1]
idx = next((i for i, m in enumerate(ms) if m['t'] == t), None)
if idx is None: continue
if rejected(ms[idx]): rej.append(s)
if is_reference(by[s]): continue
for c in ('corr_x', 'corr_y'):
v = ms[idx][c]
if v is None: continue
noise = own_noise([m[c] for m in ms if m[c] is not None])
nb = [m[c] for m in ms[max(0, idx-12):idx] + ms[idx+1:idx+13] if m[c] is not None]
if noise and nb: devs.append(((v - statistics.median(nb)) / noise, s, c))
devs.sort(key=lambda d: -abs(d[0]))
print(T, ' '.join(f"{s}{c[-1]} {d:+.1f}" for d, s, c in devs[:7]), '| rejected:', ','.join(rej))
@@ -0,0 +1,27 @@
"""Per label: largest deviation (in noises) of a target's corr_x/corr_y, from a ranges.py output.
usage: requal_measure.py <ranges.txt> <labels.jsonl> [--inclusive]"""
import json, sys, re
REFS = {'8002','8004','8011','8012','8013','8014','8017','8019','92H'}
txt, lab = sys.argv[1], sys.argv[2]
incl = '--inclusive' in sys.argv
rng = [] # (col, sensor, start, end, n, val, noises, at, rej)
col = None
for line in open(txt):
m = re.match(r'^(corr_x|corr_y): ranges', line)
if m: col = m.group(1); continue
if line.startswith('=='): col = None; continue
if col:
p = line.split()
if len(p) >= 8 and re.match(r'\d{4}-', p[1]):
rng.append((col, p[0], p[1], p[2], int(p[3]), p[4], float(p[5]), p[6], p[7]))
for l in open(lab):
d = json.loads(l); s, e = d['start'], d['end']
hits = []
for r in rng:
if r[1] in REFS: continue
ok = (r[2] <= e and r[3] >= s) if incl else (r[2] < e and r[3] > s)
if ok: hits.append(r)
hits.sort(key=lambda r: -abs(r[6]))
top = ', '.join(f"{r[1]} {r[0][-1]} {r[6]:+.1f}@{r[7][11:16]}" for r in hits[:5])
mx = abs(hits[0][6]) if hits else 0
print(f"{d.get('id','?'):14s} {s[5:]} {e[5:]} {d['family'][:12]:12s} max={mx:6.1f} n={len(hits):3d} | {top}")
@@ -0,0 +1,48 @@
"""Thermal labels: hourly median of each target's corr minus its level over the hours before the label (night part),
in the target's own noise (median |step| over the batch, as ranges.py). Hours inside a Visibility label are also
reported apart (clean = outside every non-thermal long label).
usage: requal_thermal.py <labels.jsonl> <batch start> <batch end>"""
import sys, json, statistics
from datetime import timedelta
sys.path.insert(0, 'tools/scripts')
from data import load, parse_time, is_reference
from common import own_noise
labs = [json.loads(l) for l in open(sys.argv[1])]
B0, B1 = parse_time(sys.argv[2]), parse_time(sys.argv[3])
by = load('data/LENZSPITZE')
tg = {s: ms for s, ms in by.items() if not is_reference(ms)}
vis = [(parse_time(d['start']), parse_time(d['end'])) for d in labs if d['family'] == 'Visibility']
for d in labs:
if d['family'] != 'Thermal displacement': continue
s, e = parse_time(d['start']), parse_time(d['end'])
out = []
for name, ms in tg.items():
for c in ('corr_x', 'corr_y'):
batch = [m[c] for m in ms if B0 <= m['t'] <= B1 and m[c] is not None]
noise = own_noise(batch)
if not noise: continue
night = [m[c] for m in ms if s - timedelta(hours=6) <= m['t'] < s and m[c] is not None]
if len(night) < 12: continue
lvl = statistics.median(night)
h = s
best = (0, None, False)
while h < e:
v = [m[c] for m in ms if h <= m['t'] < h + timedelta(hours=1) and m[c] is not None]
if len(v) >= 6:
dev = (statistics.median(v) - lvl) / noise
clean = not any(a < h + timedelta(hours=1) and b > h for a, b in vis)
if abs(dev) > abs(best[0]): best = (dev, h, clean)
h += timedelta(hours=1)
# best clean
h = s; bc = (0, None)
while h < e:
v = [m[c] for m in ms if h <= m['t'] < h + timedelta(hours=1) and m[c] is not None]
if len(v) >= 6 and not any(a < h + timedelta(hours=1) and b > h for a, b in vis):
dev = (statistics.median(v) - lvl) / noise
if abs(dev) > abs(bc[0]): bc = (dev, h)
h += timedelta(hours=1)
out.append((abs(best[0]), name, c, best, bc))
out.sort(reverse=True)
print(f"== {d['id']} {d['start']} -> {d['end']}")
for _, name, c, b, bc in out[:6]:
print(f" {name:6s} {c}: {b[0]:+7.1f} at {b[1]:%m-%d %H}h{'' if b[2] else ' (in Visibility)'} | outside Visibility: {bc[0]:+7.1f}" + (f" at {bc[1]:%m-%d %H}h" if bc[1] else ''))
@@ -0,0 +1,21 @@
"""Writes labels.jsonl after the requalification: drops LENZSPITZE-53, rewrites LENZSPITZE-66 (loses review), keeps the rest as is."""
import json, sys
D = sys.argv[1]
NEW66 = ("For the duration of a single measurement, just after the passage of the previous measurement, the reference 8004 "
"is hidden and rejected (its flux falls to almost nothing, with that of 8010; that of 8003, 1016, 1018, 7013B, 7013H and of "
"the reference 8002 drops clearly, the other targets keep their light): the compensation runs without 8004, the basis changes, "
"and the nearby target 1009 makes a clear jump in corr_y and in corr_x, 1006 a smaller one in corr_y; the other curves stay "
"within their noise, and everything returns at the next measurement. The 11:00 image shows nothing in front of the targets; "
"a passage in front of this corner of the scene is probable, deduced from the cut flux of the hidden targets, not seen. "
"Point to ignore, nothing to do.")
out = []
for l in open(f"{D}/work/requalify_input.jsonl"):
d = json.loads(l)
i = d.pop('id')
if i == 'LENZSPITZE-53': continue
if i == 'LENZSPITZE-66':
d = {'start': d['start'], 'end': d['end'], 'family': d['family'], 'description': NEW66}
out.append(d)
with open(f"{D}/labels.jsonl", 'w') as f:
for d in out: f.write(json.dumps(d, ensure_ascii=False) + '\n')
print(len(out))