Files
aimsight-labeling/auto/analyses/SNCF01_2026-10-04T0000_2026-10-14T0645/scripts/thermal_bounds.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

43 lines
2.3 KiB
Python

"""Per day: first instant (after 05:00) where a target's smoothed corr (median of 5) leaves the previous night level
(01:00-05:00) by > 5 own noises, and last instant (before next 06:00) where it is still > 5 noises from the next
night level; per target. Passages excluded. Usage: thermal_bounds.py folder EXCL"""
import sys, statistics
from datetime import timedelta, datetime, timezone
sys.path.insert(0, "tools/scripts")
import data, common
folder = sys.argv[1]; excl = set(sys.argv[2].split(","))
TI = {"BG.1", "F4.1", "CV.6", "CV.7", "F4.3", "F4.4"}
by = data.load(folder)
S, E = data.parse_time("2026-10-03T00:00Z"), data.parse_time("2026-10-14T12:00Z")
res = {}
for s, ms in by.items():
if data.is_reference(ms) or s in TI: continue
for col in ("corr_x", "corr_y"):
ser = [(m["t"], m[col]) for m in ms if S <= m["t"] <= E and m[col] is not None and data.iso(m["t"]) not in excl]
vals = [v for _, v in ser]
noise = common.own_noise(vals)
sm = [(t, statistics.median(vals[max(0, i-2):i+3])) for i, (t, _) in enumerate(ser)]
def night(d):
v = [x for t, x in ser if t.date() == d and 1 <= t.hour < 5]
return statistics.median(v) if v else None
for k in range(4, 15):
d = datetime(2026, 10, k, tzinfo=timezone.utc).date()
n0, n1 = night(d), night(d + timedelta(days=1))
if n0 is None: continue
seg = [(t, x) for t, x in sm if t.date() == d and t.hour >= 5]
st = next((t for t, x in seg if abs(x - n0) / noise > 5), None)
seg2 = [(t, x) for t, x in sm if (t.date() == d and t.hour >= 10) or (t.date() == d + timedelta(days=1) and t.hour < 6)]
en = None
if n1 is not None:
for t, x in seg2:
if abs(x - n1) / noise > 5: en = t
mx = max((abs(x - n0) / noise for t, x in seg), default=0)
res.setdefault(str(d), []).append((s + col[-1], st, en, mx))
for d in sorted(res):
rows = sorted(res[d], key=lambda r: -r[3])[:8]
sts = [r[1] for r in res[d] if r[1] and r[3] > 8]
ens = [r[2] for r in res[d] if r[2] and r[3] > 8]
print(d, "first", data.iso(min(sts)) if sts else "-", "last", data.iso(max(ens)) if ens else "-")
for r in rows:
print(" ", r[0], data.iso(r[1])[5:16] if r[1] else "-", data.iso(r[2])[5:16] if r[2] else "-", f"{r[3]:.1f}")