18 lines
814 B
Python
18 lines
814 B
Python
# Per UTC day and sensor, the median of error_value / error_threshold (x100) as a table. Args: <station folder> <from> <to>
|
|
import sys
|
|
from statistics import median
|
|
from pathlib import Path
|
|
sys.path[:0] = [str(Path.home() / "aimsight-tools" / "scripts")]
|
|
from data import load
|
|
folder, a, b = sys.argv[1:4]
|
|
ms = load(folder)
|
|
days = sorted({m["t"].date().isoformat() for v in ms.values() for m in v if a <= m["t"].date().isoformat() < b})
|
|
print("sensor " + " ".join(d[5:] for d in days))
|
|
for s in sorted(ms):
|
|
row = []
|
|
for d in days:
|
|
r = [m["error_value"] / m["error_threshold"] for m in ms[s] if m["t"].date().isoformat() == d
|
|
and m["error_value"] is not None and m["error_threshold"]]
|
|
row.append(f"{100 * median(r):5.0f}" if r else " -")
|
|
print(f"{s:6} " + " ".join(row))
|