diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/packet.py b/tangostationcontrol/tangostationcontrol/devices/sdp/packet.py index 61ff69c1bb671b23d3a2e1d5196eacb8a1304eab..ae21c8f5ac187aa413274a0500ff874eed23b5c6 100644 --- a/tangostationcontrol/tangostationcontrol/devices/sdp/packet.py +++ b/tangostationcontrol/tangostationcontrol/devices/sdp/packet.py @@ -543,6 +543,9 @@ def main(args=None, **kwargs): # read the packet from input packet = read_packet(sys.stdin.buffer.read) + if not packet: + break + # print header print(f"# Packet {nr} of class {packet.__class__.__name__} starting at offset {offset} with length {packet.size()}") pprint.pprint(packet.header()) diff --git a/tangostationcontrol/tangostationcontrol/test/devices/test_statistics_collector.py b/tangostationcontrol/tangostationcontrol/test/devices/test_statistics_collector.py index c5e0ca48f800d31e679e021429fe4495a58f2fe8..b2bde8e74c41fef08ecb7aff65e81fe1b6552d23 100644 --- a/tangostationcontrol/tangostationcontrol/test/devices/test_statistics_collector.py +++ b/tangostationcontrol/tangostationcontrol/test/devices/test_statistics_collector.py @@ -209,23 +209,3 @@ class TestXSTCollector(base.TestCase): self.assertEqual(0, collector.parameters["nof_valid_payloads"][fpga_index]) self.assertEqual(1, collector.parameters["nof_payload_errors"][fpga_index]) - - - -class TestBeamletPacket(base.TestCase): - def test_valid_packet(self): - # a valid packet as obtained from SDP, with 4 samples for 488 beamlets - packet = b'b\x05\x00\x00\x00\x00\x03\x85\x11\n\x00\x00\x00\x00\x00\x80\x00\x00\x00\x04\x01\xe8\x14\x00\x00\x01$\x8dI\x9c\xac\x00' + (4*488) * b'\x00\x00\x00\x00' - - # parse it - fields = BeamletPacket(packet) - - # check some fields from the header - self.assertEqual(0, fields.payload_error) - self.assertEqual(8, fields.beamlet_width) - self.assertEqual(4, fields.nof_blocks_per_packet) - self.assertEqual(488, fields.nof_beamlets_per_block) - self.assertEqual(7840, fields.expected_size()) - - # check payload dimensions: 4 time slots of 488 beamlets, x/y, real/imag - self.assertEqual((4,488,2,2), fields.payload.shape)