21 lines
1.0 KiB
Python
21 lines
1.0 KiB
Python
"""Print error_value (with its ratio to the sensor's median over the window read and to its threshold) and corr_x, corr_y of given sensors on a window. Usage: python3 sensor_values.py <detectors dir> <station folder> SENSORS(comma) FROM TO [MEDIAN_FROM]"""
|
|
import statistics
|
|
import sys
|
|
|
|
sys.path.insert(0, sys.argv[1] + "/scripts")
|
|
from data import iso, load # noqa: E402
|
|
|
|
folder, sensors, a, b = sys.argv[2], sys.argv[3].split(","), sys.argv[4], sys.argv[5]
|
|
m0 = sys.argv[6] if len(sys.argv) > 6 else "0000"
|
|
ms = load(folder)
|
|
for s in sensors:
|
|
ev = [m["error_value"] for m in ms[s] if m["error_value"] is not None and m0 <= iso(m["t"]) < b]
|
|
med = statistics.median(ev)
|
|
print(f"== {s} median {med:.3f}")
|
|
for m in ms[s]:
|
|
if a <= iso(m["t"]) <= b:
|
|
e, th = m["error_value"], m["error_threshold"]
|
|
f = lambda x: " - " if x is None else f"{x:7.3f}" # noqa: E731
|
|
print(iso(m["t"]), f(e), f"x{e / med:4.2f}" if e else "", f"/th {e / th:4.2f}" if e and th else "",
|
|
f(m["corr_x"]), f(m["corr_y"]))
|