This commit is contained in:
awe
2026-04-29 19:31:15 +03:00
parent 1d807d0afc
commit a136a6dbf9
2 changed files with 56 additions and 12 deletions

View File

@ -454,6 +454,27 @@ class ProcessingTests(unittest.TestCase):
self.assertIsNone(dec_axis)
self.assertEqual(dec_data.shape, (3, 4))
def test_bscan_background_profile_tracks_decimated_rows(self):
rows = (FFT_LEN // 2) + 1
axis = np.linspace(0.0, 10.0, rows, dtype=np.float64)
background = np.linspace(1.0, 2.0, rows, dtype=np.float32)
residual = np.linspace(0.1, 0.4, rows, dtype=np.float32)
data = background[:, None] + residual[:, None]
dec_axis, dec_data, row_idx = decimate_bscan_rows_for_display(
axis,
data,
max_points=512,
return_indices=True,
)
dec_background = background[row_idx]
subtracted = subtract_fft_background(dec_data, dec_background)
self.assertEqual(dec_axis.shape, (512,))
self.assertEqual(dec_data.shape, (512, 1))
self.assertEqual(row_idx.shape, (512,))
self.assertTrue(np.allclose(subtracted[:, 0], residual[row_idx], atol=1e-6))
def test_update_expected_sweep_width_initializes_from_first_valid_sweep(self):
self.assertEqual(update_expected_sweep_width(0, 411), 411)