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,45 @@
|
||||
"""Check the bounds of a labels file: are start/end measurement instants, which sensors are rejected or
|
||||
deviate (corr vs local median over +-1h, in own noises) at the bound, at the instant after start and before end."""
|
||||
import sys, json, statistics, datetime as dt
|
||||
sys.path.insert(0, 'tools/scripts')
|
||||
import data
|
||||
F = sys.argv[1]; K = float(sys.argv[2]) if len(sys.argv) > 2 else 6
|
||||
S = data.load('data/LENZSPITZE')
|
||||
t0, t1 = dt.datetime(2026,10,15,22,tzinfo=dt.timezone.utc), dt.datetime(2026,10,24,4,tzinfo=dt.timezone.utc)
|
||||
S = {s: [m for m in v if t0 <= m['t'] <= t1] for s, v in S.items()}
|
||||
inst = sorted({m['t'] for v in S.values() for m in v})
|
||||
idx = {t: i for i, t in enumerate(inst)}
|
||||
by = {s: {m['t']: m for m in v} for s, v in S.items()}
|
||||
noise = {}
|
||||
for s, v in S.items():
|
||||
for c in ('corr_x', 'corr_y'):
|
||||
a = [m[c] for m in v if m[c] is not None]
|
||||
d = [abs(a[i+1]-a[i]) for i in range(len(a)-1)]
|
||||
noise[s, c] = statistics.median(d) if d else 0
|
||||
def dev(s, t, c):
|
||||
m = by[s].get(t)
|
||||
if not m or m[c] is None or not noise[s, c]: return None
|
||||
w = [by[s][u][c] for u in inst if abs((u-t).total_seconds()) <= 3600 and u != t and u in by[s] and by[s][u][c] is not None]
|
||||
if len(w) < 4: return None
|
||||
return (m[c]-statistics.median(w))/noise[s, c]
|
||||
def touched(t):
|
||||
out = []
|
||||
for s in sorted(S):
|
||||
m = by[s].get(t)
|
||||
if m is None: out.append(s+':absent'); continue
|
||||
if data.rejected(m): out.append(s+':R'); continue
|
||||
for c in ('corr_x', 'corr_y'):
|
||||
d = dev(s, t, c)
|
||||
if d is not None and abs(d) >= K: out.append('%s:%s%+.0f' % (s, c[-1], d))
|
||||
return out
|
||||
P = lambda s: dt.datetime.strptime(s, '%Y-%m-%dT%H:%MZ').replace(tzinfo=dt.timezone.utc)
|
||||
for n, l in enumerate(open(F), 1):
|
||||
d = json.loads(l); a, b = P(d['start']), P(d['end'])
|
||||
print(f"#{n} {d.get('id','')} {d['start']} -> {d['end']} {d['family']}")
|
||||
for name, t in (('start', a), ('end', b)):
|
||||
if t not in idx: print(f" {name} NOT an instant"); continue
|
||||
print(f" {name} {t:%H:%M}: {' '.join(touched(t)) or '-'}")
|
||||
ia, ib = idx.get(a), idx.get(b)
|
||||
if ia is not None and ib is not None and ib - ia >= 2:
|
||||
print(f" first {inst[ia+1]:%H:%M}: {' '.join(touched(inst[ia+1])) or '-'}")
|
||||
print(f" last {inst[ib-1]:%H:%M}: {' '.join(touched(inst[ib-1])) or '-'}")
|
||||
Reference in new issue
Block a user