18 lines
986 B
Python
18 lines
986 B
Python
"""Summarise ranges.py output: per sensor and column, measurements beyond k noises within [start,end), max |noises|, max |value|."""
|
|||
|
|
import re, sys
|
||
|
|
f, start, end = sys.argv[1], sys.argv[2], sys.argv[3]
|
||
|
|
rx = re.compile(r'^(\S+?)\s*(2026-\d\d-\d\dT\d\d:\d\dZ)\s+(2026-\S+)\s+(\d+)\s+([+-][\d.e+-]+)\s+([+-]?[\d.]+)\s+(\S+)\s+(\d+)')
|
||
|
|
col = None; st = {}
|
||
|
|
for line in open(f):
|
||
|
|
m = re.match(r'^(corr_\w+): ranges', line)
|
||
|
|
if m: col = m.group(1); continue
|
||
|
|
m = rx.match(line)
|
||
|
|
if not m or col is None: continue
|
||
|
|
s, a, b, n, v, z = m.group(1), m.group(2), m.group(3), int(m.group(4)), float(m.group(5)), float(m.group(6))
|
||
|
|
if b < start or a >= end: continue
|
||
|
|
d = st.setdefault((s, col), [0, 0, 0.0, 0.0, 0])
|
||
|
|
d[0] += n; d[1] += 1
|
||
|
|
if abs(z) > abs(d[2]): d[2] = z; d[3] = v
|
||
|
|
d[4] = max(d[4], n)
|
||
|
|
for (s, c), d in sorted(st.items()):
|
||
|
|
print(f"{s:22s} {c:10s} meas>{5}: {d[0]:4d} in {d[1]:3d} ranges, longest {d[4]:3d}, extreme {d[2]:+6.1f} noises ({d[3]:+.3f})")
|