diff --git a/README.md b/README.md index eb7c1df8e6016ef29bd1e4f0358382f02eb43adc..21b80731035e101eb9fe8d1b5549f3b95efecf9b 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,8 @@ tox -e debug tests.requests.test_prometheus ``` ## 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 - l2ss-statistics-writer: Fix syntax error in printing help - More resilience against errors when interfacing with Tango diff --git a/VERSION b/VERSION index c619394525b5035a6ad50f29d726abf895325a56..3b1c7940850144076322076877708039ed967be1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.15.6 +0.15.7 diff --git a/lofar_station_client/statistics/writer/hdf5.py b/lofar_station_client/statistics/writer/hdf5.py index f8dadd3c0fd7d0e0ce7fce881efd27d00ff44042..c232acf42fd94b74cf310075959a1c525643887b 100644 --- a/lofar_station_client/statistics/writer/hdf5.py +++ b/lofar_station_client/statistics/writer/hdf5.py @@ -375,38 +375,20 @@ class HDF5Writer(ABC): matrix_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) - + def _add_device_metadata(self, matrix: StatisticsData): # add station state if self.antennafield_device: try: - matrix.hbat_pwr_on = self.antennafield_device.HBAT_PWR_on_R + if self.antennafield_device.Antenna_Type_R != "LBA": + matrix.hbat_pwr_on = self.antennafield_device.HBAT_PWR_on_R + matrix.frequency_band = self.antennafield_device.Frequency_Band_R except (DevFailed, AttributeError): logger.exception( "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: nyquist_zones = self.sdp_device.nyquist_zone_RW fpga_spectral_inversion = self.sdp_device.FPGA_spectral_inversion_R @@ -463,6 +445,30 @@ class HDF5Writer(ABC): except (DevFailed, AttributeError): 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 @abstractmethod