This commit is contained in:
awe
2026-04-09 19:56:38 +03:00
parent 08823404c0
commit 4dbedb48bc
4 changed files with 46 additions and 5 deletions

View File

@ -3,6 +3,7 @@
from __future__ import annotations
import signal
import sys
import threading
import time
from queue import Empty, Queue
@ -38,6 +39,7 @@ from rfg_adc_plotter.state import RingBuffer, RuntimeState
from rfg_adc_plotter.types import SweepAuxCurves, SweepInfo, SweepPacket
RAW_PLOT_MAX_POINTS = 4096
RAW_WATERFALL_MAX_POINTS = 2048
DEBUG_FRAME_LOG_EVERY = 10
@ -603,7 +605,7 @@ def run_pyqtgraph(args) -> None:
if finite_f.size > 0:
f_min = float(np.min(finite_f))
f_max = float(np.max(finite_f))
img.setImage(runtime.ring.get_display_raw(), autoLevels=False)
img.setImage(runtime.ring.get_display_raw_decimated(RAW_WATERFALL_MAX_POINTS), autoLevels=False)
img.setRect(0, f_min, max_sweeps, max(1e-9, f_max - f_min))
p_img.setRange(
xRange=(0, max_sweeps - 1),
@ -714,7 +716,7 @@ def run_pyqtgraph(args) -> None:
runtime.current_peak_width = None
runtime.current_peak_amplitude = None
runtime.peak_candidates = []
img.setImage(runtime.ring.get_display_raw(), autoLevels=False)
img.setImage(runtime.ring.get_display_raw_decimated(RAW_WATERFALL_MAX_POINTS), autoLevels=False)
img_fft.setImage(runtime.ring.get_display_fft_linear(), autoLevels=False)
update_physical_axes()
@ -1242,6 +1244,7 @@ def run_pyqtgraph(args) -> None:
pass
processed_frames = 0
ui_started_at = time.perf_counter()
def refresh_current_fft_cache(sweep_for_fft: np.ndarray, bins: int) -> None:
runtime.current_fft_complex = compute_fft_complex_row(
@ -1311,10 +1314,13 @@ def run_pyqtgraph(args) -> None:
queue_size = queue.qsize()
except Exception:
queue_size = -1
elapsed_s = max(time.perf_counter() - ui_started_at, 1e-9)
frames_per_sec = float(processed_frames) / elapsed_s
sys.stderr.write(
"[debug] ui frames:%d last_sweep:%s ch:%s width:%d queue:%d\n"
"[debug] ui frames:%d rate:%.2f/s last_sweep:%s ch:%s width:%d queue:%d\n"
% (
processed_frames,
frames_per_sec,
str(info.get("sweep") if isinstance(info, dict) else None),
str(info.get("ch") if isinstance(info, dict) else None),
int(getattr(sweep, "size", 0)),
@ -1640,7 +1646,7 @@ def run_pyqtgraph(args) -> None:
runtime.plot_dirty = False
if changed and runtime.ring.ring is not None:
disp = runtime.ring.get_display_raw()
disp = runtime.ring.get_display_raw_decimated(RAW_WATERFALL_MAX_POINTS)
levels = _visible_levels_pyqtgraph(disp, p_img)
if levels is not None:
img.setImage(disp, autoLevels=False, levels=levels)