try to speed up
This commit is contained in:
@ -10,6 +10,7 @@ from rfg_adc_plotter.gui.pyqtgraph_backend import (
|
||||
apply_working_range,
|
||||
apply_working_range_to_aux_curves,
|
||||
compute_background_subtracted_bscan_levels,
|
||||
decimate_curve_for_display,
|
||||
resolve_visible_fft_curves,
|
||||
resolve_visible_aux_curves,
|
||||
)
|
||||
@ -205,6 +206,28 @@ class ProcessingTests(unittest.TestCase):
|
||||
self.assertTrue(np.allclose(visible[0], aux[0]))
|
||||
self.assertTrue(np.allclose(visible[1], aux[1]))
|
||||
|
||||
def test_decimate_curve_for_display_preserves_small_series(self):
|
||||
xs = np.linspace(3.3, 14.3, 64, dtype=np.float64)
|
||||
ys = np.linspace(-1.0, 1.0, 64, dtype=np.float32)
|
||||
|
||||
decimated_x, decimated_y = decimate_curve_for_display(xs, ys, max_points=128)
|
||||
|
||||
self.assertTrue(np.allclose(decimated_x, xs))
|
||||
self.assertTrue(np.allclose(decimated_y, ys))
|
||||
|
||||
def test_decimate_curve_for_display_limits_points_and_keeps_endpoints(self):
|
||||
xs = np.linspace(3.3, 14.3, 10000, dtype=np.float64)
|
||||
ys = np.sin(np.linspace(0.0, 12.0 * np.pi, 10000)).astype(np.float32)
|
||||
|
||||
decimated_x, decimated_y = decimate_curve_for_display(xs, ys, max_points=512)
|
||||
|
||||
self.assertLessEqual(decimated_x.size, 512)
|
||||
self.assertEqual(decimated_x.shape, decimated_y.shape)
|
||||
self.assertAlmostEqual(float(decimated_x[0]), float(xs[0]), places=12)
|
||||
self.assertAlmostEqual(float(decimated_x[-1]), float(xs[-1]), places=12)
|
||||
self.assertAlmostEqual(float(decimated_y[0]), float(ys[0]), places=6)
|
||||
self.assertAlmostEqual(float(decimated_y[-1]), float(ys[-1]), places=6)
|
||||
|
||||
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