Files
aimsight-labeling/auto/analyses/NORDEND_2026-10-13T0745_2026-10-24T1630/scripts/thermal.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

61 lines
2.8 KiB
Python

"""Thermal labels: does a target keep the camera cycle beyond 5 noises from its night level?
Per target (global references CTR02-04 out; PR04, PR17, CTR01 out: their curves carry their own Target issue /
Obstruction labels): night level = median of the accepted corr over the 5 h before the label start (end of the night
that precedes); noise = own noise (median |difference| between consecutive accepted measurements) over the label;
deviation = median of 3 consecutive measurements minus the night level, in noises; instants inside a non-thermal,
non-No-data label are skipped. Prints, per label, the targets beyond 5 noises: the extreme, its instant, and how many
measurements (smoothed) are beyond.
Usage: python3 <this> <labels.jsonl>
"""
import json, statistics, sys
from datetime import timedelta
sys.path.insert(0, "tools/scripts")
import data, common
EXCL = {"CTR02", "CTR03", "CTR04", "PR04", "PR17", "CTR01"}
by = data.load("data/NORDEND")
labels = [json.loads(l) for l in open(sys.argv[1])]
other = [(data.parse_time(l["start"]), data.parse_time(l["end"])) for l in labels
if l["family"] not in ("Thermal displacement", "No data")]
def covered(t):
return any(a < t < b for a, b in other)
for l in labels:
if l["family"] != "Thermal displacement":
continue
s, e = data.parse_time(l["start"]), data.parse_time(l["end"])
print(f"{l['id']} {l['start']} {l['end']}")
rows = []
for name, ms in by.items():
if name in EXCL:
continue
for col in ("corr_x", "corr_y"):
night = [m[col] for m in ms if s - timedelta(hours=5) <= m["t"] <= s and m[col] is not None]
lab = [(m["t"], m[col]) for m in ms if s <= m["t"] <= e and m[col] is not None]
if len(night) < 5 or len(lab) < 5:
continue
lvl = statistics.median(night)
nz = common.own_noise([v for _, v in lab])
if not nz:
continue
dev = []
for i in range(1, len(lab) - 1):
t = lab[i][0]
if covered(t):
continue
v = statistics.median([lab[i - 1][1], lab[i][1], lab[i + 1][1]])
dev.append((t, (v - lvl) / nz, v - lvl))
big = [d for d in dev if abs(d[1]) > 5]
if big:
x = max(big, key=lambda d: abs(d[1]))
rows.append((abs(x[1]), f" {name:5} {col} extreme {x[1]:+.1f} noises ({x[2]:+.4f} px, noise {nz:.4f}) at "
f"{data.iso(x[0])}; {len(big)} measurements beyond, "
f"{data.iso(big[0][0])} .. {data.iso(big[-1][0])}"))
rows.sort(reverse=True)
for _, r in rows[:6]:
print(r)
print(f" targets beyond 5 noises: {len(rows)}\n")