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

Bugfixes in statistics writer

parent 950f619b
No related branches found
No related tags found
1 merge request!63Bugfixes
...@@ -105,6 +105,8 @@ tox -e debug tests.requests.test_prometheus ...@@ -105,6 +105,8 @@ tox -e debug tests.requests.test_prometheus
``` ```
## Releasenotes ## Releasenotes
- 0.15.7 - Fix: Recording LBA statistics does not request HBA-only metadata
- Fix: Syntax error when querying SDP metadata
- 0.15.6 - Represent BSTs in 488x2 arrays - 0.15.6 - Represent BSTs in 488x2 arrays
- l2ss-statistics-writer: Fix syntax error in printing help - l2ss-statistics-writer: Fix syntax error in printing help
- More resilience against errors when interfacing with Tango - More resilience against errors when interfacing with Tango
......
0.15.6 0.15.7
...@@ -375,38 +375,20 @@ class HDF5Writer(ABC): ...@@ -375,38 +375,20 @@ class HDF5Writer(ABC):
matrix_name, matrix_name,
) )
def get_matrix(self): def _add_device_metadata(self, matrix: StatisticsData):
"""Constructs a matrix for storing in the hdf5 file"""
matrix = self.get_matrix_data()
# add generic info
matrix.nof_payload_errors = self.current_collector.parameters[
"nof_payload_errors"
]
matrix.nof_valid_payloads = self.current_collector.parameters[
"nof_valid_payloads"
]
matrix.gn_indices = self.current_collector.parameters["gn_indices"]
# Stores the header of the packet received for this matrix as a list of
# attributes
if self.statistics_packet_header:
for k, val in _dict_to_hdf5_attrs(self.statistics_packet_header).items():
if hasattr(matrix, k):
setattr(matrix, k, val)
# add station state # add station state
if self.antennafield_device: if self.antennafield_device:
try: try:
if self.antennafield_device.Antenna_Type_R != "LBA":
matrix.hbat_pwr_on = self.antennafield_device.HBAT_PWR_on_R matrix.hbat_pwr_on = self.antennafield_device.HBAT_PWR_on_R
matrix.frequency_band = self.antennafield_device.Frequency_Band_R matrix.frequency_band = self.antennafield_device.Frequency_Band_R
except (DevFailed, AttributeError): except (DevFailed, AttributeError):
logger.exception( logger.exception(
"Failed to read from %s", self.antennafield_device.name() "Failed to read from %s", self.antennafield_device.name()
) )
if self.sdp_device and self.antenna_sdp_mapping: if self.sdp_device and self.antenna_sdp_mapping is not None:
try: try:
nyquist_zones = self.sdp_device.nyquist_zone_RW nyquist_zones = self.sdp_device.nyquist_zone_RW
fpga_spectral_inversion = self.sdp_device.FPGA_spectral_inversion_R fpga_spectral_inversion = self.sdp_device.FPGA_spectral_inversion_R
...@@ -463,6 +445,30 @@ class HDF5Writer(ABC): ...@@ -463,6 +445,30 @@ class HDF5Writer(ABC):
except (DevFailed, AttributeError): except (DevFailed, AttributeError):
logger.exception("Failed to read from %s", self.tilebeam_device.name()) logger.exception("Failed to read from %s", self.tilebeam_device.name())
def get_matrix(self):
"""Constructs a matrix for storing in the hdf5 file"""
matrix = self.get_matrix_data()
# add generic info
matrix.nof_payload_errors = self.current_collector.parameters[
"nof_payload_errors"
]
matrix.nof_valid_payloads = self.current_collector.parameters[
"nof_valid_payloads"
]
matrix.gn_indices = self.current_collector.parameters["gn_indices"]
# Stores the header of the packet received for this matrix as a list of
# attributes
if self.statistics_packet_header:
for k, val in _dict_to_hdf5_attrs(self.statistics_packet_header).items():
if hasattr(matrix, k):
setattr(matrix, k, val)
# Add metadata of Tango devices
self._add_device_metadata(matrix)
return matrix return matrix
@abstractmethod @abstractmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment