31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
"""At chosen instants (and the measurement before and after): per sensor, corr_x and corr_y minus the median of the
|
|||
|
|
4 measurements on each side (without the instants +-1), error_value; R = rejected.
|
||
|
|
|
||
|
|
usage: python3 instants.py T1,T2,...
|
||
|
|
"""
|
||
|
|
import statistics, sys
|
||
|
|
from datetime import timedelta
|
||
|
|
sys.path.insert(0, "tools/scripts")
|
||
|
|
import data
|
||
|
|
|
||
|
|
meas = data.load("data/WYOMING")
|
||
|
|
by = {s: {m["t"].replace(second=0, microsecond=0): m for m in v} for s, v in meas.items()}
|
||
|
|
q = timedelta(minutes=15)
|
||
|
|
for txt in sys.argv[1].split(","):
|
||
|
|
t0 = data.parse_time(txt)
|
||
|
|
print("=== around", txt)
|
||
|
|
for t in (t0 - q, t0, t0 + q):
|
||
|
|
cells = []
|
||
|
|
for s in sorted(by):
|
||
|
|
if t not in by[s]:
|
||
|
|
cells.append(s[-2:] + ":-"); continue
|
||
|
|
m = by[s][t]
|
||
|
|
if data.rejected(m):
|
||
|
|
cells.append(s[-2:] + ":R"); continue
|
||
|
|
nb = [by[s].get(t0 + k * q) for k in list(range(-6, -1)) + list(range(2, 7))]
|
||
|
|
nb = [n for n in nb if n and n["corr_x"] is not None]
|
||
|
|
dx = m["corr_x"] - statistics.median([n["corr_x"] for n in nb])
|
||
|
|
dy = m["corr_y"] - statistics.median([n["corr_y"] for n in nb])
|
||
|
|
flag = "*" if max(abs(dx), abs(dy)) > 0.08 else ""
|
||
|
|
cells.append("%s:%+.2f/%+.2f%s" % (s[-2:], dx, dy, flag))
|
||
|
|
print(t.strftime("%dT%H:%M"), " ".join(cells))
|