auto: the analysts verified the labels of 32 periods (11 stations, up to 14 days each): 710 labels -> 835, 587 unchanged; one analysis folder per period with its report (section Verification)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df979301b5
commit
2a5d87659b
279 files changed
+10758
-710
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""Per instant of [START, END]: sensors rejected (R), and sensors whose corr_x / corr_y deviate from a baseline
|
||||
(median of the accepted measurements in BASE window, default the hour before START) by more than K own noises.
|
||||
Usage: win.py START END [K] [BASE_START BASE_END] [--sensors A,B] [--flux]"""
|
||||
import sys, statistics, datetime as dt
|
||||
sys.path.insert(0, 'tools/scripts')
|
||||
import data
|
||||
a = sys.argv[1:]
|
||||
sens = None
|
||||
if '--sensors' in a: i = a.index('--sensors'); sens = a[i+1].split(','); del a[i:i+2]
|
||||
P = lambda s: dt.datetime.strptime(s, '%Y-%m-%dT%H:%MZ').replace(tzinfo=dt.timezone.utc)
|
||||
A, B = P(a[0]), P(a[1]); K = float(a[2]) if len(a) > 2 else 5
|
||||
BA, BB = (P(a[3]), P(a[4])) if len(a) > 4 else (A - dt.timedelta(hours=1), A - dt.timedelta(minutes=1))
|
||||
S = data.load('data/LENZSPITZE')
|
||||
lo, hi = min(A, BA) - dt.timedelta(days=1), max(B, BB) + dt.timedelta(hours=1)
|
||||
S = {s: [m for m in v if lo <= m['t'] <= hi] for s, v in S.items() if not sens or s in sens}
|
||||
out = []
|
||||
for s, v in S.items():
|
||||
for c in ('corr_x', 'corr_y'):
|
||||
al = [m[c] for m in v if m[c] is not None]
|
||||
nz = statistics.median([abs(al[i+1]-al[i]) for i in range(len(al)-1)]) if len(al) > 2 else 0
|
||||
base = [m[c] for m in v if BA <= m['t'] <= BB and m[c] is not None]
|
||||
if not base or not nz: continue
|
||||
lv = statistics.median(base)
|
||||
for m in v:
|
||||
if A <= m['t'] <= B:
|
||||
if data.rejected(m):
|
||||
if c == 'corr_x': out.append((m['t'], s + ':R'))
|
||||
elif m[c] is not None and abs(m[c]-lv) > K*nz:
|
||||
out.append((m['t'], '%s:%s%+.0f' % (s, c[-1], (m[c]-lv)/nz)))
|
||||
inst = sorted({m['t'] for v in S.values() for m in v if A <= m['t'] <= B})
|
||||
for t in inst:
|
||||
print(f"{t:%m-%d %H:%M}", ' '.join(sorted(x for u, x in out if u == t)))
|
||||
Reference in new issue
Block a user