REJECT_MAX of heat shimmer and CALM of target_issue removed

Heat shimmer is no longer dropped for its rejections beyond each sensor's habit (Visibility found +2: WILDSTRUBEL +7,
NIEDERHORN +4). target_issue counts every measurement of the day, not only the calm instants (Obstruction found +3,
correct -2: correct -11 at LENZSPITZE and -12 at WILDSTRUBEL; Target issue unchanged).

Benchmark Totals (from the previous commit): Visibility found 55 -> 57 %; Obstruction found 42 -> 45 %, correct
33 -> 31 %; the other families unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 17:28:59 +01:00
1 parent 4188efe201
commit ab0347c41d
2 files changed
+18 -38

No files matched your search

+2 -11
View File
@@ -132,12 +132,9 @@ def detect(measurements):
# 1. Per sensor and per hour H, over [H - 1 h, H + 2 h): agitation, the median of |Δcorr_x| + |Δcorr_y| between successive
# measurements, and the median error_value; each divided by its calm (lower quartile of the sensor's hourly values).
# 2. Turbulent hour: at least SHARE of the sensors agitated at RATIO times their calm, and median error_value at RATIO.
# 3. Turbulent hours at most 2 h apart make an episode, dropped if more than REJECT_MAX of its measurements are rejected
# beyond each sensor's habit (its share of rejections over the export): that is poor visibility. Greyed if the median
# agitation reaches STRONG.
# 3. Turbulent hours at most 2 h apart make an episode, greyed if the median agitation reaches STRONG.
RATIO = 1.5 # E-003 (WILDSTRUBEL: by day, corr ×1.7 to ×3 the night, error_value ×1.7 to ×3.2)
SHARE = 0.5
REJECT_MAX = 0.15 # E-003 ≤ 7 %; cobweb (E-002) and rain (E-005) ≥ 18 %; beyond the habit: wf-improve Visibility, mod. 1, S1
STRONG = 2.0 # E-003 (×2.3 to ×2.6)
HOUR = timedelta(hours=1)
SHIMMER = "Warm air made the readings shake ({:.1f}× noisier than in calm hours). The small fast wiggles are not movement."
@@ -164,16 +161,10 @@ def heat_shimmer(measurements):
hours.setdefault(h, {})[s] = (ag[h], er[h])
turbulent = [h for h, r in sorted(hours.items()) if sum(a >= RATIO for a, _ in r.values()) >= SHARE * len(r)
and statistics.median(e for _, e in r.values()) >= RATIO]
habit = {s: sum(m["corr_x"] is None for m in ms) / len(ms) for s, ms in measurements.items()}
out = []
for b in runs(turbulent, 2 * HOUR):
start, end = b[0], b[-1] + HOUR
by = {s: [m for m in ms if start <= m["t"] < end] for s, ms in measurements.items()}
new = sum(max(0, sum(m["corr_x"] is None for m in d) - habit[s] * len(d)) for s, d in by.items())
if new > REJECT_MAX * sum(map(len, by.values())):
continue
agit = {s: statistics.median(hours[h][s][0] for h in b if s in hours[h]) for s in {s for h in b for s in hours[h]}}
strength = statistics.median(agit.values())
out.append(episode(start, end, "Visibility", "Heat shimmer", SHIMMER.format(strength),
out.append(episode(b[0], b[-1] + HOUR, "Visibility", "Heat shimmer", SHIMMER.format(strength),
[s for s, v in agit.items() if v >= RATIO], strength >= STRONG))
return out