- 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>
49 lines
2.6 KiB
Python
49 lines
2.6 KiB
Python
"""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 ''))
|