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,40 @@
|
||||
"""Instants where many targets deviate together, same sign, from their rolling local level.
|
||||
For each target and column (corr_x, corr_y), deviation = value - median of the +-N neighbouring
|
||||
accepted measurements (itself excluded), in units of the target's own noise (median |step|).
|
||||
Prints the instants where at least K targets exceed THR noises with the same sign.
|
||||
Usage: python3 group_flips.py START END [N=6] [THR=3] [K=6]"""
|
||||
import csv, glob, sys, statistics as st
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
S = datetime.fromisoformat(sys.argv[1].replace('Z', '+00:00'))
|
||||
E = datetime.fromisoformat(sys.argv[2].replace('Z', '+00:00'))
|
||||
N = int(sys.argv[3]) if len(sys.argv) > 3 else 6
|
||||
THR = float(sys.argv[4]) if len(sys.argv) > 4 else 3
|
||||
K = int(sys.argv[5]) if len(sys.argv) > 5 else 6
|
||||
REFS = {'D-302-C', 'PR-291', 'PR-293', 'PR-295', 'PR-296'}
|
||||
data = {}
|
||||
d = S.date() - timedelta(days=1)
|
||||
while d <= E.date():
|
||||
for f in glob.glob(f'data/CLARIDEN/displacement/CLARIDEN_advanced_{d:%Y%m%d}.csv'):
|
||||
for r in csv.DictReader(open(f)):
|
||||
t = r['time_utc'][:16].replace(' ', 'T') + 'Z'
|
||||
tt = datetime.fromisoformat(t.replace('Z', '+00:00'))
|
||||
if not (S <= tt <= E) or r['sensor_name'] in REFS or r['corr_x'] == '':
|
||||
continue
|
||||
data.setdefault(r['sensor_name'], {})[t] = (float(r['corr_x']), float(r['corr_y']))
|
||||
d += timedelta(days=1)
|
||||
dev = {}
|
||||
for s, series in data.items():
|
||||
ts = sorted(series)
|
||||
for i, col in enumerate(('x', 'y')):
|
||||
v = [series[t][i] for t in ts]
|
||||
noise = st.median(abs(v[j + 1] - v[j]) for j in range(len(v) - 1)) or 1e-9
|
||||
for j, t in enumerate(ts):
|
||||
nb = v[max(0, j - N):j] + v[j + 1:j + 1 + N]
|
||||
dev.setdefault(t, []).append((s, col, (v[j] - st.median(nb)) / noise))
|
||||
for t in sorted(dev):
|
||||
for col in ('x', 'y'):
|
||||
for sign in (1, -1):
|
||||
hit = [(s, round(z, 1)) for s, c, z in dev[t] if c == col and z * sign > THR]
|
||||
if len(hit) >= K:
|
||||
print(t, f'corr_{col}', '+' if sign > 0 else '-', len(hit), ' '.join(f'{s}:{z}' for s, z in sorted(hit, key=lambda h: -abs(h[1]))))
|
||||
Reference in new issue
Block a user