Skip to content
Snippets Groups Projects
Commit c50691aa authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-917: Improved tests to detect 90/180 degree errors

parent b6ddd811
No related branches found
No related tags found
1 merge request!404L2SS-917: Digital beamweights need to be negative
......@@ -65,15 +65,21 @@ class TestBeamletDevice(base.TestCase):
self.assertEqual(to_complex(bf_weights[1][2]), -1 + 0j, msg=f"bf_weights = {bf_weights}")
def test_calculate_bf_weights_actual_numbers(self):
# we test phase offsets with 90 degree increments to weed out:
# - sign errors (-1-2j instead of 1+2j == 180 degree offset)
# - complex conjugation errors (1-2j instead of 1+2j == 180 degree offset)
# - real/imaginary swap errors (2+1j instead of 1+2j == 90 degree offset)
#
# NB: -180 degree rotation == +180 degree rotation, so we need 90 degree
# offsets to detect 180 degree errors as well.
# 2 beamlets, 3 antennas. The antennas are 1 second apart.
delays = numpy.array([
[0.0, 2.5e-9, 5.0e-9]
[0.0, 1.25e-9, 2.5e-9, 3.75e-9, 5.0e-9]
])
# the frequency of the signal is 1.0 Hz and 0.5 Hz respectively,
# so the antennas will be either in phase or in opposite phase
beamlet_frequencies = numpy.array([
[200e6, 200e6, 200e6]
[200e6, 200e6, 200e6, 200e6, 200e6]
])
bf_weights = Beamlet._calculate_bf_weights(delays, beamlet_frequencies)
......@@ -81,8 +87,10 @@ class TestBeamletDevice(base.TestCase):
self.assertEqual(delays.shape, bf_weights.shape)
self.assertEqual(to_complex(bf_weights[0][0]), 1 + 0j, msg=f"bf_weights = {bf_weights}")
self.assertEqual(to_complex(bf_weights[0][1]), -1 + 0j, msg=f"bf_weights = {bf_weights}")
self.assertEqual(to_complex(bf_weights[0][2]), 1 + 0j, msg=f"bf_weights = {bf_weights}")
self.assertEqual(to_complex(bf_weights[0][1]), 0 - 1j, msg=f"bf_weights = {bf_weights}")
self.assertEqual(to_complex(bf_weights[0][2]), -1 + 0j, msg=f"bf_weights = {bf_weights}")
self.assertEqual(to_complex(bf_weights[0][3]), 0 + 1j, msg=f"bf_weights = {bf_weights}")
self.assertEqual(to_complex(bf_weights[0][4]), 1 + 0j, msg=f"bf_weights = {bf_weights}")
def test_subband_frequencies(self):
subbands = numpy.array([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment