Files
aimsight-optimizer/sessions/NORDEND_2026-11-05T0600_2026-11-05T1200_20261116T1028Z/tools/thermal_gaps.py
T

18 lines
890 B
Python

"""Print the hourly gap profile (share of amplitude from the night level) that thermal_displacement.py uses for its bounds, for corr and raw positions, on a range plus 3 days of history. Usage: python3 thermal_gaps.py <detectors dir> <station folder> FROM TO"""
import sys
from datetime import timedelta
sys.path.insert(0, sys.argv[1] + "/scripts")
import thermal_displacement as td # noqa: E402
from data import load, parse_time # noqa: E402
folder, a, b = sys.argv[2:5]
ms = load(folder)
h, e = parse_time(a) - timedelta(days=3), parse_time(b)
chunk = {s: k for s, x in ms.items() if (k := [m for m in x if h <= m["t"] < e])}
for cols in (("corr_x", "corr_y"), ("x", "y")):
concerned, n = td.cycle(chunk, cols)
print(cols, f"{len({c[0] for c in concerned})}/{n} targets")
if concerned:
print(" ".join(f"{h:02d}:{g:.2f}" for h, g in enumerate(td.gaps(concerned))))