From 5faced1b65b693b8e39dc3a4ae145db5f33fc512 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Fri, 7 Jun 2024 11:42:34 +0000 Subject: [PATCH] Replace deprecated Antenna_Quality_str_R --- README.md | 2 ++ VERSION | 2 +- lofar_station_client/statistics/collectors/_xst.py | 2 +- lofar_station_client/statistics/constants.py | 1 + lofar_station_client/statistics/writer/hdf5.py | 6 +++--- tests/statistics/test_collector.py | 4 ++-- tests/test_devices.py | 6 +++++- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c886fba..8c65ffa 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,8 @@ tox -e debug tests.requests.test_prometheus ## Release notes +- 0.19.0 - Compatibility with tangostationcontrol 0.35.0: query Antenna_Status_R, which + replaced Antenna_Quality_str_R in tangostationcontrol 0.35.0. - 0.18.8 - Migrate case insensitive dict from station control - 0.18.7 - Add support for various ZeroMQ package receivers - 0.18.6 - Compatability with new black versions diff --git a/VERSION b/VERSION index 0f2596a..1cf0537 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.18.8 +0.19.0 diff --git a/lofar_station_client/statistics/collectors/_xst.py b/lofar_station_client/statistics/collectors/_xst.py index c04510a..552f1b1 100644 --- a/lofar_station_client/statistics/collectors/_xst.py +++ b/lofar_station_client/statistics/collectors/_xst.py @@ -44,7 +44,7 @@ class XSTCollector(StatisticsCollector): """ # Maximum number of subbands for which we collect XSTs simultaneously - MAX_PARALLEL_SUBBANDS = 8 + MAX_PARALLEL_SUBBANDS = 7 # Maximum number of antenna inputs we support (used to determine array sizes) MAX_INPUTS = 192 diff --git a/lofar_station_client/statistics/constants.py b/lofar_station_client/statistics/constants.py index eb11c84..c1466c2 100644 --- a/lofar_station_client/statistics/constants.py +++ b/lofar_station_client/statistics/constants.py @@ -14,6 +14,7 @@ DEFAULT_STATISTICS_PORTS: Dict[str, Dict[str, int]] = { "HBA1": {"SST": 5121, "XST": 5122, "BST": 5123}, } + # Which TCP host each statistic is exposed on, # as DEFAULT_STATISTICS_HOST[mode]. DEFAULT_STATISTICS_HOSTS: Dict[str, str] = { diff --git a/lofar_station_client/statistics/writer/hdf5.py b/lofar_station_client/statistics/writer/hdf5.py index d62a1f0..90e9a58 100644 --- a/lofar_station_client/statistics/writer/hdf5.py +++ b/lofar_station_client/statistics/writer/hdf5.py @@ -235,9 +235,9 @@ class HDF5Writer(ABC): self.file.antenna_type = "HBA" if self.af_family == "AFH" else "LBA" self.file.rcu_pcb_id = self.antennafield_device.RCU_PCB_ID_R self.file.rcu_pcb_version = self.antennafield_device.RCU_PCB_version_R - self.file.antenna_quality = ( - self.antennafield_device.Antenna_Quality_str_R - ) # noqa + self.file.antenna_quality = [ + s.name for s in self.antennafield_device.Antenna_Status_R + ] # noqa self.file.antenna_usage_mask = ( self.antennafield_device.Antenna_Usage_Mask_R ) # noqa diff --git a/tests/statistics/test_collector.py b/tests/statistics/test_collector.py index 9059419..65aeff5 100644 --- a/tests/statistics/test_collector.py +++ b/tests/statistics/test_collector.py @@ -85,7 +85,7 @@ class TestXSTCollector(base.TestCase): self.assertEqual(fpga_index, collector.parameters["gn_indices"][0]) self.assertListEqual( - [102, 0, 0, 0, 0, 0, 0, 0], list(collector.parameters["xst_subbands"]) + [102, 0, 0, 0, 0, 0, 0], list(collector.parameters["xst_subbands"]) ) # check whether the data ended up in the right block, and the rest is still zero @@ -245,7 +245,7 @@ class TestXSTCollector(base.TestCase): # counters should now be updated self.assertListEqual( - [102, 103, 0, 0, 0, 0, 0, 0], list(collector.parameters["xst_subbands"]) + [102, 103, 0, 0, 0, 0, 0], list(collector.parameters["xst_subbands"]) ) # check whether the data ended up in the right block, and the rest is still diff --git a/tests/test_devices.py b/tests/test_devices.py index c647d4c..02fb62a 100644 --- a/tests/test_devices.py +++ b/tests/test_devices.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy) # SPDX-License-Identifier: Apache-2.0 +from enum import Enum from unittest import mock from unittest.mock import MagicMock @@ -283,11 +284,14 @@ class RecvDeviceProxyTest(base.TestCase): class FakeAntennaFieldDeviceProxy: """DeviceProxy that mocks access to an AntennaField device.""" + class AntennaStatus(Enum): + OK = 0 + nr_antennas_R = 3 Antenna_to_SDP_Mapping_R = [[0, 0], [0, 1], [0, 2]] Antenna_Names_R = ["Aap", "Noot", "Mies"] Antenna_Reference_ITRF_R = [[0, 0, 0]] * nr_antennas_R - Antenna_Quality_str_R = ["OK"] * nr_antennas_R + Antenna_Status_R = [AntennaStatus.OK] * nr_antennas_R Antenna_Usage_Mask_R = [True] * nr_antennas_R Frequency_Band_RW = ["HBA_110_190"] * nr_antennas_R RCU_attenuator_dB_R = [0, 1, 2] -- GitLab