db format

This commit is contained in:
awe
2026-04-29 19:44:47 +03:00
parent a136a6dbf9
commit f9bca446b2
2 changed files with 25 additions and 4 deletions

View File

@ -20,6 +20,7 @@ from rfg_adc_plotter.gui.pyqtgraph_backend import (
convert_tty_i16_to_voltage,
decimate_bscan_rows_for_display,
decimate_curve_for_display,
fft_bscan_image_to_db,
is_short_sweep,
resolve_axis_bounds,
resolve_bscan_refresh_stride,
@ -599,6 +600,17 @@ class ProcessingTests(unittest.TestCase):
self.assertIsNone(levels)
def test_fft_bscan_image_to_db_converts_linear_magnitudes(self):
linear = np.asarray([[1.0, 10.0], [0.0, 100.0]], dtype=np.float32)
displayed = fft_bscan_image_to_db(linear)
self.assertIsNotNone(displayed)
self.assertTrue(np.allclose(displayed, fft_mag_to_db(linear)))
self.assertAlmostEqual(float(displayed[0, 0]), 0.0, places=5)
self.assertGreater(float(displayed[1, 0]), -181.0)
self.assertLess(float(displayed[1, 0]), -179.0)
def test_fft_helpers_return_expected_shapes(self):
sweep = np.sin(np.linspace(0.0, 4.0 * np.pi, 128)).astype(np.float32)
freqs = np.linspace(3.3, 14.3, 128, dtype=np.float64)