"""common_jump.py col h0 h1: per day and instant, median over targets of (value - median of the 3 before and 3 after), x1000""" import sys, os, statistics; sys.path.insert(0, os.path.dirname(__file__)); import common from datetime import timedelta d = common.get(); M = d["meas"]; col = sys.argv[1]; h0, h1 = float(sys.argv[2]), float(sys.argv[3]) TG = [s for s in ("PR01","PR02","PR03","PR05","PR06","PR07","PR08","PR09","PR10","PR11","PR12","PR13","PR14","PR15","PR16","PR18")] def v(t, s): m = M.get(t, {}).get(s); return m[col] if m and not m["rej"] else None 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); devs = [] for s in TG: x = v(t, s) nb = [y for k in (-3,-2,-1,1,2,3) for y in [v(t + timedelta(minutes=15*k), s)] if y is not None] if x is not None and len(nb) >= 4: devs.append(x - statistics.median(nb)) row.append("%6.0f" % (statistics.median(devs) * 1e3) if len(devs) > 5 else " - ") print("%02d:%02d " % divmod(m, 60) + " ".join(row)); m += 15