22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
# Per UTC day and sensor, the median absolute step of corr_x and corr_y (non-rejected points), x1000, as a table. Args: <station folder> <from> <to> [sensors,...]
|
|
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]
|
|
only = sys.argv[4].split(",") if len(sys.argv) > 4 else None
|
|
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):
|
|
if only and s not in only:
|
|
continue
|
|
ok = [m for m in ms[s] if m["corr_x"] is not None and not (m["error_value"] and m["error_threshold"] and m["error_value"] > m["error_threshold"])]
|
|
row = []
|
|
for d in days:
|
|
p = [m for m in ok if m["t"].date().isoformat() == d]
|
|
st = [abs(q[k] - r[k]) for r, q in zip(p, p[1:]) for k in ("corr_x", "corr_y") if q[k] is not None and r[k] is not None]
|
|
row.append(f"{1000 * median(st):5.0f}" if st else " -")
|
|
print(f"{s:6} " + " ".join(row))
|