fix
This commit is contained in:
@ -41,6 +41,22 @@ class RingBufferTests(unittest.TestCase):
|
||||
self.assertIsNotNone(ring.last_fft_db)
|
||||
self.assertEqual(ring.last_fft_db.shape, (ring.fft_bins,))
|
||||
|
||||
def test_ring_buffer_can_return_decimated_display_raw(self):
|
||||
ring = RingBuffer(max_sweeps=3)
|
||||
sweep_a = np.linspace(0.0, 1.0, 4096, dtype=np.float32)
|
||||
sweep_b = np.linspace(1.0, 2.0, 4096, dtype=np.float32)
|
||||
sweep_c = np.linspace(2.0, 3.0, 4096, dtype=np.float32)
|
||||
freqs = np.linspace(3.3, 14.3, 4096, dtype=np.float64)
|
||||
ring.push(sweep_a, freqs)
|
||||
ring.push(sweep_b, freqs)
|
||||
ring.push(sweep_c, freqs)
|
||||
|
||||
raw = ring.get_display_raw_decimated(256)
|
||||
|
||||
self.assertEqual(raw.shape, (256, 3))
|
||||
self.assertAlmostEqual(float(raw[0, -1]), float(sweep_c[0]), places=6)
|
||||
self.assertAlmostEqual(float(raw[-1, -1]), float(sweep_c[-1]), places=6)
|
||||
|
||||
def test_ring_buffer_can_switch_fft_mode_and_rebuild_fft_rows(self):
|
||||
ring = RingBuffer(max_sweeps=2)
|
||||
sweep = np.linspace(0.0, 1.0, 64, dtype=np.float32)
|
||||
|
||||
Reference in New Issue
Block a user