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

L2DTS-272: Test transpose of XST data

parent 6cc1fb99
No related branches found
No related tags found
1 merge request!16L2DTS-272: Turn XSTs into a matrix before transposing, not afterwards
Pipeline #35486 failed
...@@ -135,17 +135,19 @@ class TestXSTCollector(base.TestCase): ...@@ -135,17 +135,19 @@ class TestXSTCollector(base.TestCase):
f"but was written to the XST matrix.", f"but was written to the XST matrix.",
) )
def test_conjugated_packet(self): def test_conjugated_transposed_packet(self):
"""Test packet payload conjugation with a baseline (a,b) where a<b""" """Test packet payload conjugation & transposewith a baseline (a,b) where a<b"""
collector = XSTCollector() collector = XSTCollector()
# a valid packet as obtained from SDP, with 64-bit BE 1+1j as payload, at # a valid packet as obtained from SDP.
# baseline (0,12) VV VV # the first 72 samples are 1+1j, the second 72 samples are 2+2j (64-bit BE).
# at baseline (0,12) VV VV
packet = ( packet = (
b"X\x05\x00\x00\x00\x00\x00\x00\x10\x08\x00\x02\xfa\xef\x00f\x00\x0c\x0c" b"X\x05\x00\x00\x00\x00\x00\x00\x10\x08\x00\x02\xfa\xef\x00f\x00\x0c\x0c"
b"\x08\x01 \x14\x00\x00\x01!\xd9&z\x1b\xb3" b"\x08\x01 \x14\x00\x00\x01!\xd9&z\x1b\xb3"
+ 288 * b"\x00\x00\x00\x00\x00\x00\x00\x01" + 144 * b"\x00\x00\x00\x00\x00\x00\x00\x01"
+ 144 * b"\x00\x00\x00\x00\x00\x00\x00\x02"
) )
# parse it ourselves to extract info nicely # parse it ourselves to extract info nicely
...@@ -165,6 +167,11 @@ class TestXSTCollector(base.TestCase): ...@@ -165,6 +167,11 @@ class TestXSTCollector(base.TestCase):
# zero # zero
xst_values = collector.xst_values()[0] xst_values = collector.xst_values()[0]
# number of complex values that should end up in the XST matrix
correct_nr_values = 144
# number of values we've counted so far
actual_nr_values = 0
for baseline_a in range(collector.MAX_INPUTS): for baseline_a in range(collector.MAX_INPUTS):
for baseline_b in range(collector.MAX_INPUTS): for baseline_b in range(collector.MAX_INPUTS):
if baseline_b > baseline_a: if baseline_b > baseline_a:
...@@ -184,12 +191,25 @@ class TestXSTCollector(base.TestCase): ...@@ -184,12 +191,25 @@ class TestXSTCollector(base.TestCase):
) )
if baseline_a_was_in_packet and baseline_b_was_in_packet: if baseline_a_was_in_packet and baseline_b_was_in_packet:
# through conjugation, the imaginary part is made negative
# through transposition, the second dimension (b) now is the divider
# between the two distinct values
if baseline_b - fields.first_baseline[0] < 6:
self.assertEqual( self.assertEqual(
1 - 1j, 1 - 1j,
xst_values[baseline_a][baseline_b], xst_values[baseline_a][baseline_b],
msg=f"element [{baseline_a}][{baseline_b}] did not end up " msg=f"element [{baseline_a}][{baseline_b}] did not end up "
f"conjugated in XST matrix.", f"conjugated & transposed in XST matrix.",
) )
else:
self.assertEqual(
2 - 2j,
xst_values[baseline_a][baseline_b],
msg=f"element [{baseline_a}][{baseline_b}] did not end up "
f"conjugated & transposed in XST matrix.",
)
actual_nr_values += 1
else: else:
self.assertEqual( self.assertEqual(
0 + 0j, 0 + 0j,
...@@ -198,6 +218,8 @@ class TestXSTCollector(base.TestCase): ...@@ -198,6 +218,8 @@ class TestXSTCollector(base.TestCase):
f"but was written to the XST matrix.", f"but was written to the XST matrix.",
) )
self.assertEqual(correct_nr_values, actual_nr_values, "Mismatch between number of values in the packet and in the resulting matrix")
def test_multiple_subbands(self): def test_multiple_subbands(self):
collector = XSTCollector() collector = XSTCollector()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment