Files
aimsight-labeling/auto/analyses/FLORIDA_2026-10-11T0945_2026-10-22T0315/scripts/requalify.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

35 lines
2.1 KiB
Python

"""Per label: max deviation of each target's corr_x/corr_y (px and mm) from its level before the label, in its own noise.
Level = median of the non-empty values in the LEVEL hours before start (night level for a thermal label).
Noise = median |diff| of consecutive non-empty measurements over the whole range (as ranges.py)."""
import sys, json, statistics as st
from datetime import timedelta
sys.path.insert(0, "tools/scripts")
import data
D = sys.argv[1]; LEVEL = float(sys.argv[2]) if len(sys.argv) > 2 else 3
S = data.load("data/FLORIDA/")
T0, T1 = data.parse_time("2026-10-11T09:45Z"), data.parse_time("2026-10-22T03:15Z")
targets = ["Sellette 4", "Sellette 5", "Massif 2", "Sellette 6"]
noise = {}
for s in targets:
ms = data.filter_window(S[s], T0, T1)
for c in ("corr_x", "corr_y", "corr_x_mm", "corr_y_mm"):
v = [m[c] for m in ms if m[c] is not None]
noise[s, c] = st.median(abs(a - b) for a, b in zip(v, v[1:])) if len(v) > 2 else None
for line in open(D + "/work/requalify_input.jsonl"):
L = json.loads(line); a, b = data.parse_time(L["start"]), data.parse_time(L["end"])
out = []
for s in targets:
before = data.filter_window(S[s], a - timedelta(hours=LEVEL), a - timedelta(minutes=1))
inside = data.filter_window(S[s], a + timedelta(minutes=1), b - timedelta(minutes=1)) or data.filter_window(S[s], a, b)
for c in ("corr_x", "corr_y"):
lv = [m[c] for m in before if m[c] is not None]
iv = [(m[c], m[c + "_mm"], m["t"]) for m in inside if m[c] is not None]
if not lv or not iv or not noise[s, c]:
continue
l = st.median(lv); lmm = st.median([m[c + "_mm"] for m in before if m[c + "_mm"] is not None] or [0])
v, vmm, t = max(iv, key=lambda x: abs(x[0] - l))
k = (v - l) / noise[s, c]
out.append((abs(k), f"{s} {c[-1]} {k:+.1f}n ({vmm - lmm if vmm is not None else float('nan'):+.1f}mm) @{data.iso(t)[11:16]}"))
out.sort(reverse=True)
print(L["id"], L["start"][5:16], L["end"][5:16], L["family"][:10], "|", "; ".join(x[1] for x in out[:4]))