Files
aimsight-labeling/auto/analyses/NORDEND_2026-10-13T0745_2026-10-24T1630/scripts/levels.py
T

15 lines
787 B
Python
Raw Normal View History

"""Median corr_x / corr_y of each sensor over chosen windows (accepted measurements), to compare levels across days."""
import sys, os, pickle, statistics
sys.path.insert(0, "tools/scripts")
import data
D, CAM = pickle.load(open(os.path.join(os.path.dirname(__file__), "..", "work", "cache.pkl"), "rb"))
W = sys.argv[2:]
col = sys.argv[1]
print("sensor " + " ".join("%9s" % w.split("/")[0][5:13] for w in W))
for s in sorted(D, key=lambda s: (not s.startswith("CTR0") or s == "CTR01", s)):
out = []
for w in W:
a, b = map(data.parse_time, w.split("/"))
v = [m[col] for m in data.filter_window(D[s], a, b) if m[col] is not None and not data.rejected(m)]
out.append("%9.3f" % statistics.median(v) if v else " -")
print("%-6s" % s, " ".join(out))