Essai arrêté : batch du 2026-11-06 (scan, séance interrompue sans commit), audit du scan du 06, bilan de l'essai ; suivre.py --fin
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7e24df09a0
commit
010c297f60
35 files changed
+904
-2
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# Print, around an instant, what visibility.py point 2 sees: high sensors (n), sensors rejected at FACTOR x their median, rejected sensors.
|
||||
# Usage: python3 brief_debug.py <detectors dir> <station folder> <from ISO> <to ISO>
|
||||
import statistics
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, sys.argv[1] + "/scripts")
|
||||
import data # noqa: E402
|
||||
import visibility as V # noqa: E402
|
||||
|
||||
ms = data.load(sys.argv[2])
|
||||
a, b = data.parse_time(sys.argv[3]), data.parse_time(sys.argv[4])
|
||||
refs = {s for s, v in ms.items() if v[0]["pattern_type"] == "global_ref"}
|
||||
rows = {}
|
||||
for s, v in ms.items():
|
||||
e = [m["error_value"] for m in v if m["error_value"] is not None]
|
||||
if len(e) < 10:
|
||||
continue
|
||||
med = statistics.median(e)
|
||||
mad = statistics.median(abs(x - med) for x in e) or 1e-9
|
||||
for m in v:
|
||||
x = m["error_value"]
|
||||
if x is None or not a <= m["t"] <= b:
|
||||
continue
|
||||
rej = m["error_threshold"] and x > m["error_threshold"]
|
||||
r = rows.setdefault(m["t"], {"high": [], "strong": [], "rej": []})
|
||||
if x > med + V.K_MAD * mad and (x > V.FACTOR * med or rej and x > V.REJECT_FACTOR * med):
|
||||
r["high"].append(s)
|
||||
if rej:
|
||||
r["rej"].append(s)
|
||||
if x > V.FACTOR * med:
|
||||
r["strong"].append(s + ("(R)" if s in refs else ""))
|
||||
for t in sorted(rows):
|
||||
r = rows[t]
|
||||
print(f"{t:%H:%M} high={sorted(r['high'])} strong={sorted(r['strong'])} rejected={len(r['rej'])}")
|
||||
@@ -0,0 +1,37 @@
|
||||
# Diff the events (as score.py computes them: the range in one pass, 3 days of history) between two detector folders.
|
||||
# Usage: python3 diff_events.py <detectors A> <detectors B> <station folder> <from YYYY-MM-DD> <to YYYY-MM-DD> [family]
|
||||
import importlib.util
|
||||
import sys
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
def load_mod(d, name):
|
||||
sys.path.insert(0, d + "/scripts")
|
||||
spec = importlib.util.spec_from_file_location(name, d + "/scripts/categories.py")
|
||||
m = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(m)
|
||||
sys.path.pop(0)
|
||||
for k in [k for k in sys.modules if k in ("data", "visibility", "target_issue", "displacement")]:
|
||||
del sys.modules[k]
|
||||
return m
|
||||
|
||||
|
||||
def run(d, folder, a, b):
|
||||
c = load_mod(d, "cat_" + str(abs(hash(d))))
|
||||
import data
|
||||
ms = data.load(folder)
|
||||
s, e = data.parse_time(a), data.parse_time(b)
|
||||
chunk = {k: x for k, v in ms.items() if (x := [m for m in v if s - timedelta(days=3) <= m["t"] < e])}
|
||||
out = set()
|
||||
for v in c.events(chunk, folder=folder):
|
||||
if v["end"] >= data.iso(s) and (len(sys.argv) < 7 or v["category"] == sys.argv[6]):
|
||||
out.add(f"{v['start']} → {v['end']} {v['category']:<20} {v['episodes'][0]['label']} | {','.join(v['sensors'][:5])}")
|
||||
return out
|
||||
|
||||
|
||||
A = run(sys.argv[1], sys.argv[3], sys.argv[4], sys.argv[5])
|
||||
B = run(sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
|
||||
for x in sorted(A - B):
|
||||
print("<", x)
|
||||
for x in sorted(B - A):
|
||||
print(">", x)
|
||||
@@ -0,0 +1,25 @@
|
||||
# Dump, per sensor, error_value / threshold / sensor median and corr_x, corr_y over a time window (rejected = '*').
|
||||
# Usage: python3 window.py <detectors dir> <station folder> <from ISO> <to ISO> [--refs-only]
|
||||
import statistics
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, sys.argv[1] + "/scripts")
|
||||
import data # noqa: E402
|
||||
|
||||
ms = data.load(sys.argv[2])
|
||||
a, b = data.parse_time(sys.argv[3]), data.parse_time(sys.argv[4])
|
||||
for s, v in sorted(ms.items()):
|
||||
ref = v[0]["pattern_type"] == "global_ref"
|
||||
if "--refs-only" in sys.argv and not ref:
|
||||
continue
|
||||
e = [m["error_value"] for m in v if m["error_value"] is not None]
|
||||
med = statistics.median(e) if e else 0
|
||||
row = []
|
||||
for m in v:
|
||||
if a <= m["t"] <= b:
|
||||
ev, th = m["error_value"], m["error_threshold"]
|
||||
rej = "*" if ev is not None and th and ev > th else " "
|
||||
cx = " - " if m["corr_x"] is None else f"{m['corr_x']:+.1f}"
|
||||
cy = " - " if m["corr_y"] is None else f"{m['corr_y']:+.1f}"
|
||||
row.append(f"{m['t']:%H:%M}{rej}{(ev or 0) / med if med else 0:.1f}x {cx},{cy}")
|
||||
print(f"{s[:14]:<14}{'R' if ref else ' '} th/med={((v[-1]['error_threshold'] or 0) / med) if med else 0:.1f} | " + " | ".join(row))
|
||||
Reference in new issue
Block a user