"""rows: time of day; columns: days. usage: matrix.py h0 h1 [scale]""" import sys, os; sys.path.insert(0, os.path.dirname(__file__)); import common from datetime import timedelta d = common.get(); P = d["pose"]; M = d["meas"] col, h0, h1 = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]); k = float(sys.argv[4]) if len(sys.argv) > 4 else 1e3 days = [common.T("2026-09-30T00:00Z") + timedelta(days=i) for i in range(14)] print("time " + " ".join(dd.strftime(" %d/%m ") for dd in days)) m = int(h0 * 60) while m <= h1 * 60: row = [] for dd in days: t = dd + timedelta(minutes=m) if ":" in col: s, c = col.split(":"); v = M.get(t, {}).get(s, {}).get(c) if s in M.get(t, {}) and M[t][s]["rej"]: row.append(" rej "); continue else: v = P.get(t, {}).get(col) if col == "scale" and v is not None: v -= 1 row.append("%7.2f" % (v * k) if v is not None else " - ") print("%02d:%02d " % divmod(m % 1440, 60) + " ".join(row)) m += 15