Files
aimsight-labeling/auto/analyses/NEBRASKA_2026-10-03T0000_2026-10-13T0000/scripts/night_dev.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

46 lines
2.3 KiB
Python

"""Requalification of the thermal labels: deviation of each target from its night level, in its own noises.
Noise: own_noise (median of consecutive differences) over a calm-ish window before the 9 October jump.
Night level: median of the start-bound measurement and the one before it (the evening/night before the cycle).
Prints, per label, the largest deviations (px, mm, noises) of the targets inside the label (bounds excluded).
"""
import statistics
import sys
from datetime import datetime, timezone
sys.path.insert(0, "tools/scripts")
from common import own_noise # noqa: E402
from data import load, is_reference # noqa: E402
T = lambda s: datetime.strptime(s, "%Y-%m-%dT%H:%MZ").replace(tzinfo=timezone.utc)
NOISE_WIN = (T("2026-10-03T00:00Z"), T("2026-10-09T08:00Z"))
LABELS = [("NEBRASKA-12", "2026-10-04T00:00Z", "2026-10-04T16:00Z"),
("NEBRASKA-13", "2026-10-04T20:00Z", "2026-10-05T16:00Z"),
("NEBRASKA-14", "2026-10-05T20:00Z", "2026-10-06T20:00Z")]
by = load("data/NEBRASKA")
for lid, s, e in LABELS:
s, e = T(s), T(e)
rows = []
for name, ms in by.items():
if is_reference(ms):
continue
for col in ("corr_x", "corr_y"):
win = [m[col] for m in ms if NOISE_WIN[0] <= m["t"] <= NOISE_WIN[1] and m[col] is not None]
noise = own_noise(win)
before = [m for m in ms if m["t"] <= s and m[col] is not None][-2:]
if not noise or len(before) < 2:
continue
lvl = statistics.median(m[col] for m in before)
lvl_mm = statistics.median(m[col + "_mm"] for m in before) if all(m[col + "_mm"] is not None for m in before) else None
for m in ms:
if s < m["t"] < e and m[col] is not None:
d = m[col] - lvl
dmm = m[col + "_mm"] - lvl_mm if lvl_mm is not None and m[col + "_mm"] is not None else None
rows.append((abs(d) / noise, name, col, m["t"].strftime("%d/%m %H:%M"), d, dmm))
rows.sort(reverse=True)
print(f"== {lid} {s:%d/%m %H:%M} -> {e:%d/%m %H:%M}: top deviations from the night level")
for k, name, col, t, d, dmm in rows[:8]:
mm = f"{dmm:+.2f} mm" if dmm is not None else " ? mm"
print(f" {name:8} {col:6} {t} {d:+.4f} px {mm} {d / abs(d) * k:+.1f} noises")