Number of valid points now calculates before the filling of the missing points. Also averaging is done by 1 sec. (was 10 secs)

This commit is contained in:
2026-01-28 17:22:10 +03:00
parent c0b33ace67
commit e995f04193

View File

@ -305,6 +305,10 @@ class SweepReader(threading.Thread):
for x, y in zip(xs, ys):
if 0 <= x < target_width:
sweep[x] = float(y)
# Метрики валидных точек до заполнения пропусков
finite_pre = np.isfinite(sweep)
n_valid_cur = int(np.count_nonzero(finite_pre))
# Дополнительная обработка пропусков: при --fancy заполняем внутренние разрывы, края и дотягиваем до максимальной длины
if self._fancy:
try:
@ -342,8 +346,6 @@ class SweepReader(threading.Thread):
else:
dt_ms = (now - self._last_sweep_ts) * 1000.0
self._last_sweep_ts = now
finite = np.isfinite(sweep)
n_valid_cur = int(np.count_nonzero(finite))
self._n_valid_hist.append((now, n_valid_cur))
while self._n_valid_hist and (now - self._n_valid_hist[0][0]) > 10.0:
self._n_valid_hist.popleft()