"""Print the drift detector's daily levels of a sensor (kept days, level, amplitude). Args: detectors_dir station sensor from to""" import sys from datetime import datetime, timezone from pathlib import Path det, folder, sensor, start, end = sys.argv[1:6] sys.path.insert(0, str(Path(det) / "scripts")); sys.path.insert(0, str(Path.home() / "aimsight-tools/scripts")) import displacement as D from data import load, parse_time ms = [m for m in load(folder)[sensor] if parse_time(start) <= m["t"] < parse_time(end)] for col in ("corr_x", "corr_y"): ds, lv, ampl, _ = D._days(ms, col) print(col, "ampl", round(ampl, 3), "whole", D._whole(ds, lv, ampl, _) if len(ds) > 1 else None, "pieces", D._pieces(ds, lv, ampl, _) if len(ds) > 1 else None) for d, l in zip(ds, lv): print(" ", d, round(l, 3))