# Prints, per target and axis, the daily levels used by displacement.drift (in units of the median daily amplitude), the whole-window test and the pieces kept. Args: [sensor,...] import sys from datetime import datetime, timedelta, timezone from pathlib import Path det = Path(sys.argv[1]).resolve() sys.path[:0] = [str(det / "scripts"), str(det.parents[0] / "aimsight-tools" / "scripts"), str(Path.cwd() / "tools" / "scripts")] import displacement as D from data import load, is_reference day = lambda d: datetime.strptime(d, "%Y-%m-%d").replace(tzinfo=timezone.utc) start, end = day(sys.argv[3]), day(sys.argv[4]) only = sys.argv[5].split(",") if len(sys.argv) > 5 else None ms = load(sys.argv[2]) for s, v in sorted(ms.items()): if is_reference(v) or (only and s not in only): continue k = [m for m in v if start - timedelta(days=3) <= m["t"] < end] for col in ("corr_x", "corr_y"): ds, lv, ampl, _ = D._days(k, col) if len(ds) < 2: continue w = D._whole(ds, lv, ampl, None) p = D._pieces(ds, lv, ampl, None) if not (w or p) and not only: continue print(f"{s} {col} ampl={ampl:.4f} whole={w} pieces={[(round(d/ampl,2), str(ds[i]), str(ds[j])) for d,i,j in p]}") print(" ", " ".join(f"{d.day:02d}:{(x-lv[0])/ampl:+.1f}" for d, x in zip(ds, lv)))