Files
T

15 lines
938 B
Python

"""Per measurement of a sensor in a window: value, distance to the median of the BASE previous, in noises (as displacement._jumps sees it). Args: detectors_dir station sensor axis from to [hist_from]"""
import sys, statistics
from pathlib import Path
det, folder, sensor, axis, a, b = sys.argv[1:7]
h = sys.argv[7] if len(sys.argv) > 7 else "2026-09-04"
sys.path.insert(0, str(Path(det) / "scripts")); sys.path.insert(0, str(Path.home() / "aimsight-tools/scripts"))
import displacement as D
from episodes import noise
from data import load, parse_time, iso
ms = [m for m in load(folder)[sensor] if parse_time(h) <= m["t"] < parse_time(b) and m[axis] is not None]
v = [m[axis] for m in ms]; n = noise(v); print("noise", round(n, 4), "K*n", round(D.K * n, 3))
for i in range(D.BASE, len(v)):
if iso(ms[i]["t"]) >= a:
base = statistics.median(v[i - D.BASE:i]); print(iso(ms[i]["t"]), round(v[i], 3), round((v[i] - base) / n, 1))