improve: S1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 16:16:36 +01:00
1 parent f57e6ea045
commit e03d911433
1 file changed
+11 -4
+11 -4
View File
@@ -31,7 +31,10 @@ measurements, outside --outside).
--instants ends with the numbers of the labels that cover the instant ("labels: none" otherwise); then, per label,
the measurements strictly inside it (start < instant < end, the instant to the minute: a measurement at a bound is
the point before or after), the largest deviation inside from the level (sensor, column, signed, in noises, instant)
and the number of instants inside where a sensor is more than --k noises from it; then the size of the label, up
and the number of instants inside where a sensor is more than --k noises from it, and "as far around": how many
measurements of that sensor-column within --margin before the start and after the end (outside the label) are at
least as far from the level, of those (0: the label stands out from its surroundings; many: the sensor already
moves that much around it; the same whatever window the noise comes from); then the size of the label, up
to --top sensor-columns (default 5), largest first: the extreme inside from the level before the label (median of
the --margin before its start, default 6h; signed, in units and in noises, instant) and the net change (median of
the --margin after its end minus that level), with the number of measurements before and after, and how many of
@@ -178,8 +181,9 @@ def main():
if labels:
print(f"\nPer label ({o.labels}): measurements strictly inside, largest deviation from the level"
f"{' rolling ±' + roll if roll else ''} ({', '.join(columns)}), instants with a sensor more than {o.k:g} noises")
print(f"{'n':>4} {'id':<16}{'start':<18}{'end':<18}{'family':<22}{'inside':>7} largest deviation (noises, at) instants > k")
f"{' rolling ±' + roll if roll else ''} ({', '.join(columns)}), instants with a sensor more than {o.k:g} noises; "
f"as far around: the measurements of that sensor-column within the {int(o.margin.total_seconds() // 60)} min before and after, outside the label, at least as far from the level, of those")
print(f"{'n':>4} {'id':<16}{'start':<18}{'end':<18}{'family':<22}{'inside':>7} largest deviation (noises, at) instants > k as far around")
m = int(o.margin.total_seconds() // 60)
print(f"{'':6}{'sensor.column':<22}{'before':>7}{'extreme':>11}{'(n)':>8} {'at':<17}{'net':>11}{'(n)':>8}{'after':>6}{'>k':>9}"
f" (then, up to {o.top} per label: extreme inside from the median of the {m} min before the start;"
@@ -192,7 +196,10 @@ def main():
else:
t, s, col, d = max(ins, key=lambda x: abs(x[3]))
over = len({minute(x[0]) for x in ins if abs(x[3]) > o.k})
print(head + f"{len({minute(x[0]) for x in ins}):7} {s + '.' + ABBREV.get(col, col):<14}{d:+8.1f} {iso(t):<17}{over:>5}")
near = [abs(x[3]) for x in deviations if x[1] == s and x[2] == col # same sensor-column, within --margin, outside the label
and t0 - o.margin <= minute(x[0]) <= t1 + o.margin and not t0 < minute(x[0]) < t1]
print(head + f"{len({minute(x[0]) for x in ins}):7} {s + '.' + ABBREV.get(col, col):<14}{d:+8.1f} {iso(t):<17}{over:>5}"
f"{f'{sum(v >= abs(d) for v in near)}/{len(near)}':>12}")
rows = [] # size against the level before the label, and the level after it (net alone without a measurement inside)
for (s, col), (ms, noise) in values.items():
pre = [v for t, v in ms if t0 - o.margin <= minute(t) <= t0]