Skip to content
Snippets Groups Projects
Commit 4654e584 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-630: refactor statistics_collector

parent 353d904f
No related branches found
No related tags found
1 merge request!296Resolve L2SS-630 "Refactor functions graded c"
...@@ -210,12 +210,7 @@ class XSTCollector(StatisticsCollector): ...@@ -210,12 +210,7 @@ class XSTCollector(StatisticsCollector):
assert 0 <= subband_slot < self.MAX_PARALLEL_SUBBANDS, f"Selected slot {subband_slot}, but only have room for {self.MAX_PARALLEL_SUBBANDS}. Existing slots are {self.parameters['xst_subbands']}, processing subband {fields.subband_index}." assert 0 <= subband_slot < self.MAX_PARALLEL_SUBBANDS, f"Selected slot {subband_slot}, but only have room for {self.MAX_PARALLEL_SUBBANDS}. Existing slots are {self.parameters['xst_subbands']}, processing subband {fields.subband_index}."
# log if we're replacing a subband we were once recording # log if we're replacing a subband we were once recording
previous_subband_in_slot = self.parameters["xst_subbands"][subband_slot] self._log_replacing_subband(subband_slot, fields)
if previous_subband_in_slot != fields.subband_index:
previous_subband_timestamp = datetime.datetime.fromtimestamp(self.parameters["xst_timestamps"][subband_slot])
if previous_subband_timestamp.timestamp() > 0:
logger.info(f"Stopped recording XSTs for subband {previous_subband_in_slot}. Last data for this subband was received at {previous_subband_timestamp}.")
# 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.
...@@ -236,6 +231,15 @@ class XSTCollector(StatisticsCollector): ...@@ -236,6 +231,15 @@ class XSTCollector(StatisticsCollector):
self.parameters["xst_subbands"][subband_slot] = numpy.uint16(fields.subband_index) self.parameters["xst_subbands"][subband_slot] = numpy.uint16(fields.subband_index)
self.parameters["xst_integration_intervals"][subband_slot] = fields.integration_interval() self.parameters["xst_integration_intervals"][subband_slot] = fields.integration_interval()
def _log_replacing_subband(self, subband_slot, fields):
# log if we're replacing a subband we were once recording
previous_subband_in_slot = self.parameters["xst_subbands"][subband_slot]
if previous_subband_in_slot != fields.subband_index:
previous_subband_timestamp = datetime.datetime.fromtimestamp(self.parameters["xst_timestamps"][subband_slot])
if previous_subband_timestamp.timestamp() > 0:
logger.info(f"Stopped recording XSTs for subband {previous_subband_in_slot}. Last data for this subband was received at {previous_subband_timestamp}.")
def xst_values(self, subband_indices = None): def xst_values(self, subband_indices = None):
""" xst_blocks, but as a matrix[len(subband_indices)][MAX_INPUTS][MAX_INPUTS] of complex values. """ xst_blocks, but as a matrix[len(subband_indices)][MAX_INPUTS][MAX_INPUTS] of complex values.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment