24 lines
1.2 KiB
Python
24 lines
1.2 KiB
Python
"""Deviation of every target (corr_x, corr_y) from the median of its ±12 neighbours, in its batch noise, at given instants;
|
|||
|
|
the 6 largest, and rejected sensors. usage: requal_instant.py T1 T2 ..."""
|
||
|
|
import sys, statistics
|
||
|
|
sys.path.insert(0, 'tools/scripts')
|
||
|
|
from data import load, parse_time, is_reference, rejected
|
||
|
|
from common import own_noise
|
||
|
|
B0, B1 = parse_time('2026-10-23T23:55Z'), parse_time('2026-11-01T11:40Z')
|
||
|
|
by = load('data/LENZSPITZE')
|
||
|
|
for T in sys.argv[1:]:
|
||
|
|
t = parse_time(T); devs = []; rej = []
|
||
|
|
for s, ms in by.items():
|
||
|
|
ms = [m for m in ms if B0 <= m['t'] <= B1]
|
||
|
|
idx = next((i for i, m in enumerate(ms) if m['t'] == t), None)
|
||
|
|
if idx is None: continue
|
||
|
|
if rejected(ms[idx]): rej.append(s)
|
||
|
|
if is_reference(by[s]): continue
|
||
|
|
for c in ('corr_x', 'corr_y'):
|
||
|
|
v = ms[idx][c]
|
||
|
|
if v is None: continue
|
||
|
|
noise = own_noise([m[c] for m in ms if m[c] is not None])
|
||
|
|
nb = [m[c] for m in ms[max(0, idx-12):idx] + ms[idx+1:idx+13] if m[c] is not None]
|
||
|
|
if noise and nb: devs.append(((v - statistics.median(nb)) / noise, s, c))
|
||
|
|
devs.sort(key=lambda d: -abs(d[0]))
|
||
|
|
print(T, ' '.join(f"{s}{c[-1]} {d:+.1f}" for d, s, c in devs[:7]), '| rejected:', ','.join(rej))
|