fix
This commit is contained in:
@ -9,6 +9,7 @@ from rfg_adc_plotter.constants import FFT_LEN, SWEEP_FREQ_MAX_GHZ, SWEEP_FREQ_MI
|
||||
from rfg_adc_plotter.gui.pyqtgraph_backend import (
|
||||
apply_working_range,
|
||||
apply_working_range_to_aux_curves,
|
||||
coalesce_packets_for_ui,
|
||||
compute_background_subtracted_bscan_levels,
|
||||
decimate_curve_for_display,
|
||||
resolve_visible_fft_curves,
|
||||
@ -228,6 +229,30 @@ class ProcessingTests(unittest.TestCase):
|
||||
self.assertAlmostEqual(float(decimated_y[0]), float(ys[0]), places=6)
|
||||
self.assertAlmostEqual(float(decimated_y[-1]), float(ys[-1]), places=6)
|
||||
|
||||
def test_coalesce_packets_for_ui_keeps_newest_packets(self):
|
||||
packets = [
|
||||
(np.asarray([float(idx)], dtype=np.float32), {"sweep": idx}, None)
|
||||
for idx in range(6)
|
||||
]
|
||||
|
||||
kept, skipped = coalesce_packets_for_ui(packets, max_packets=2)
|
||||
|
||||
self.assertEqual(skipped, 4)
|
||||
self.assertEqual(len(kept), 2)
|
||||
self.assertEqual(int(kept[0][1]["sweep"]), 4)
|
||||
self.assertEqual(int(kept[1][1]["sweep"]), 5)
|
||||
|
||||
def test_coalesce_packets_for_ui_never_returns_empty_for_non_empty_input(self):
|
||||
packets = [
|
||||
(np.asarray([1.0], dtype=np.float32), {"sweep": 1}, None),
|
||||
]
|
||||
|
||||
kept, skipped = coalesce_packets_for_ui(packets, max_packets=0)
|
||||
|
||||
self.assertEqual(skipped, 0)
|
||||
self.assertEqual(len(kept), 1)
|
||||
self.assertEqual(int(kept[0][1]["sweep"]), 1)
|
||||
|
||||
def test_background_subtracted_bscan_levels_ignore_zero_floor(self):
|
||||
disp_fft_lin = np.zeros((4, 8), dtype=np.float32)
|
||||
disp_fft_lin[1, 2:6] = np.asarray([0.05, 0.1, 0.5, 2.0], dtype=np.float32)
|
||||
|
||||
Reference in New Issue
Block a user