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,34 @@
|
||||
"""Edge check of each non-thermal label: per sensor, deviation (in noises) of corr_x/corr_y at the measurements
|
||||
around start and end, against the median of the 2 h before start and 2 h after end (outside the label).
|
||||
'R' = rejected. Prints only sensors touched (>K) at start, end, or the step just outside. Usage: edges.py LABELS K"""
|
||||
import sys, json, statistics
|
||||
from datetime import timedelta
|
||||
sys.path.insert(0, 'tools/scripts')
|
||||
import data
|
||||
lab, K = sys.argv[1], float(sys.argv[2])
|
||||
by = data.load('data/NORDEND')
|
||||
Q = timedelta(minutes=15)
|
||||
for l in map(json.loads, open(lab)):
|
||||
if l['family'] == 'Thermal displacement': continue
|
||||
a, b = data.parse_time(l['start']), data.parse_time(l['end'])
|
||||
out = []
|
||||
for s, ms in by.items():
|
||||
if s == 'PR04': continue
|
||||
d = {m['t'].replace(second=0, microsecond=0): m for m in ms if a - 9*Q <= m['t'].replace(second=0, microsecond=0) <= b + 9*Q}
|
||||
for c in ('corr_x', 'corr_y'):
|
||||
ref = [m[c] for t, m in d.items() if (t < a or t > b) and m[c] is not None]
|
||||
allv = [d[t][c] for t in sorted(d) if d[t][c] is not None]
|
||||
if len(ref) < 4: continue
|
||||
noise = statistics.median(abs(allv[i+1]-allv[i]) for i in range(len(allv)-1)) or 1e-9
|
||||
lev = statistics.median(ref)
|
||||
cells = []
|
||||
for t in (a - Q, a, a + Q, b - Q, b, b + Q):
|
||||
m = d.get(t)
|
||||
if m is None: cells.append(' -'); continue
|
||||
if data.rejected(m): cells.append(' R'); continue
|
||||
cells.append(f"{(m[c]-lev)/noise:+3.0f}")
|
||||
vals = [abs(int(x)) for x in (cells[0], cells[1], cells[4], cells[5]) if x.strip() not in ('-', 'R')]
|
||||
flag = any(v > K for v in vals) or 'R' in (cells[0].strip(), cells[1].strip(), cells[4].strip(), cells[5].strip())
|
||||
if flag: out.append(f" {s}:{c[-1]} " + ' '.join(cells))
|
||||
print(l.get('id', '?'), l['start'], l['end'], l['family'], ' cols: s-1 s s+1 e-1 e e+1')
|
||||
print('\n'.join(out) if out else ' (edges clean)')
|
||||
Reference in new issue
Block a user