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

L2SS-436: Conjugate XSTs if they are from the other triangle of the matrix...

L2SS-436: Conjugate XSTs if they are from the other triangle of the matrix (a<b for a baseline (a,b))
parent b7286f1a
Branches
Tags
1 merge request!149L2SS-436: Conjugate XSTs if they are from the other triangle of the matrix...
...@@ -131,6 +131,8 @@ class XSTCollector(StatisticsCollector): ...@@ -131,6 +131,8 @@ class XSTCollector(StatisticsCollector):
# Last value array we've constructed out of the packets # Last value array we've constructed out of the packets
"xst_blocks": numpy.zeros((self.MAX_BLOCKS, self.BLOCK_LENGTH * self.BLOCK_LENGTH * self.VALUES_PER_COMPLEX), dtype=numpy.int64), "xst_blocks": numpy.zeros((self.MAX_BLOCKS, self.BLOCK_LENGTH * self.BLOCK_LENGTH * self.VALUES_PER_COMPLEX), dtype=numpy.int64),
# Whether the values are actually conjugated
"xst_conjugated": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.bool_),
"xst_timestamps": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.float64), "xst_timestamps": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.float64),
"xst_subbands": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.uint16), "xst_subbands": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.uint16),
"integration_intervals": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.float32), "integration_intervals": numpy.zeros((self.MAX_BLOCKS,), dtype=numpy.float32),
...@@ -162,6 +164,14 @@ class XSTCollector(StatisticsCollector): ...@@ -162,6 +164,14 @@ class XSTCollector(StatisticsCollector):
if fields.first_baseline[antenna] % self.BLOCK_LENGTH != 0: if fields.first_baseline[antenna] % self.BLOCK_LENGTH != 0:
raise ValueError("Packet describes baselines starting at %s, but we require a multiple of BLOCK_LENGTH=%d" % (fields.first_baseline, self.MAX_INPUTS)) raise ValueError("Packet describes baselines starting at %s, but we require a multiple of BLOCK_LENGTH=%d" % (fields.first_baseline, self.MAX_INPUTS))
# Make sure we always have a baseline (a,b) with a>=b. If not, we swap the indices and mark that the data must be conjugated when processed.
first_baseline = fields.first_baseline[antenna]
if first_baseline[0] < first_baseline[1]:
conjugated = True
first_baseline = (first_baseline[1], first_baseline[0])
else:
conjugated = False
# the payload contains complex values for the block of baselines of size BLOCK_LENGTH x BLOCK_LENGTH # the payload contains complex values for the block of baselines of size BLOCK_LENGTH x BLOCK_LENGTH
# starting at baseline first_baseline. # starting at baseline first_baseline.
# #
...@@ -176,6 +186,7 @@ class XSTCollector(StatisticsCollector): ...@@ -176,6 +186,7 @@ class XSTCollector(StatisticsCollector):
self.parameters["xst_blocks"][block_index][:fields.nof_statistics_per_packet] = fields.payload self.parameters["xst_blocks"][block_index][:fields.nof_statistics_per_packet] = fields.payload
self.parameters["xst_timestamps"][block_index] = numpy.float64(fields.timestamp().timestamp()) self.parameters["xst_timestamps"][block_index] = numpy.float64(fields.timestamp().timestamp())
self.parameters["xst_conjugated"][block_index] = conjugated
self.parameters["xst_subbands"][block_index] = numpy.uint16(fields.subband_index) self.parameters["xst_subbands"][block_index] = numpy.uint16(fields.subband_index)
self.parameters["integration_intervals"][block_index] = fields.integration_interval() self.parameters["integration_intervals"][block_index] = fields.integration_interval()
...@@ -184,11 +195,16 @@ class XSTCollector(StatisticsCollector): ...@@ -184,11 +195,16 @@ class XSTCollector(StatisticsCollector):
matrix = numpy.zeros((self.MAX_INPUTS, self.MAX_INPUTS), dtype=numpy.complex64) matrix = numpy.zeros((self.MAX_INPUTS, self.MAX_INPUTS), dtype=numpy.complex64)
xst_blocks = self.parameters["xst_blocks"] xst_blocks = self.parameters["xst_blocks"]
xst_conjugated = self.parameters["xst_conjugated"]
for block_index in range(self.MAX_BLOCKS): for block_index in range(self.MAX_BLOCKS):
# convert real/imag int to complex float values. this works as real/imag come in pairs # convert real/imag int to complex float values. this works as real/imag come in pairs
block = xst_blocks[block_index].astype(numpy.float32).view(numpy.complex64) block = xst_blocks[block_index].astype(numpy.float32).view(numpy.complex64)
if xst_conjugated[block_index]:
# block is conjugated. conjugate back.
block = block.conjugate()
# reshape into [a][b] # reshape into [a][b]
block = block.reshape(self.BLOCK_LENGTH, self.BLOCK_LENGTH) block = block.reshape(self.BLOCK_LENGTH, self.BLOCK_LENGTH)
......
...@@ -118,6 +118,8 @@ class XST(Statistics): ...@@ -118,6 +118,8 @@ class XST(Statistics):
nof_payload_errors_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "nof_payload_errors"}, dims=(XSTCollector.MAX_FPGAS,), datatype=numpy.uint64) nof_payload_errors_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "nof_payload_errors"}, dims=(XSTCollector.MAX_FPGAS,), datatype=numpy.uint64)
# latest XSTs # latest XSTs
xst_blocks_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "xst_blocks"}, dims=(XSTCollector.BLOCK_LENGTH * XSTCollector.BLOCK_LENGTH * XSTCollector.VALUES_PER_COMPLEX, XSTCollector.MAX_BLOCKS), datatype=numpy.int64) xst_blocks_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "xst_blocks"}, dims=(XSTCollector.BLOCK_LENGTH * XSTCollector.BLOCK_LENGTH * XSTCollector.VALUES_PER_COMPLEX, XSTCollector.MAX_BLOCKS), datatype=numpy.int64)
# whether the values in the block are conjugated
xst_conjugated_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "xst_conjugated"}, dims=(XSTCollector.MAX_BLOCKS,), datatype=numpy.bool_)
# reported timestamp for each row in the latest XSTs # reported timestamp for each row in the latest XSTs
xst_timestamp_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "xst_timestamps"}, dims=(XSTCollector.MAX_BLOCKS,), datatype=numpy.uint64) xst_timestamp_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "xst_timestamps"}, dims=(XSTCollector.MAX_BLOCKS,), datatype=numpy.uint64)
# which subband the XSTs describe # which subband the XSTs describe
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment