26 lines
1.2 KiB
Python
26 lines
1.2 KiB
Python
# 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))
|