Files
T

24 lines
1.0 KiB
Python
Raw Normal View History

"""Per station, per target and axis: its noise (median step) relative to the median noise of the station's targets on that axis, lowest first.
Usage: python3 noises.py <data folder> [STATION ...]
"""
import statistics
import sys
from pathlib import Path
ROOT = Path("/home/maxime/aimsight-optimizer")
sys.path[:0] = [str(ROOT / "detectors" / "scripts"), str(ROOT / "tools" / "scripts")]
from data import load, is_reference # noqa: E402
from episodes import noise # noqa: E402
data = Path(sys.argv[1])
names = sys.argv[2:] or sorted(p.name for p in data.iterdir() if p.is_dir())
for st in names:
ms_all = load(str(data / st))
for ax in ("corr_x", "corr_y"):
ns = {s: noise([m[ax] for m in ms if m[ax] is not None]) for s, ms in ms_all.items() if not is_reference(ms)}
ns = {s: n for s, n in ns.items() if n}
if not ns:
continue
med = statistics.median(ns.values())
low = sorted(ns.items(), key=lambda x: x[1])[:4]
print(st, ax, f"median {med:.4f}", " ".join(f"{s}={n / med:.3f}" for s, n in low))