From 42560a4a0cdb4bac0f9efe52efd527f972c318eb Mon Sep 17 00:00:00 2001 From: stedif <stefano.difrischia@inaf.it> Date: Thu, 11 Aug 2022 16:25:35 +0200 Subject: [PATCH] L2SS-827: bug fixes --- .../tangostationcontrol/devices/antennafield.py | 9 ++++++--- .../default/devices/test_device_antennafield.py | 9 ++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/devices/antennafield.py b/tangostationcontrol/tangostationcontrol/devices/antennafield.py index 80709b1d8..4c39a6bde 100644 --- a/tangostationcontrol/tangostationcontrol/devices/antennafield.py +++ b/tangostationcontrol/tangostationcontrol/devices/antennafield.py @@ -6,12 +6,15 @@ """ AntennaField Device Server for LOFAR2.0 """ -from tango import DeviceProxy, DevSource, AttrWriteType, DevVarFloatArray, DevVarLongArray -from tango.server import device_property, attribute, command from enum import IntEnum -import numpy from math import pi +import numpy + +# PyTango imports +from tango import DeviceProxy, DevSource, AttrWriteType, DevVarFloatArray, DevVarLongArray +from tango.server import device_property, attribute, command +# Additional import from tangostationcontrol.common.entrypoint import entry from tangostationcontrol.devices.lofar_device import lofar_device from tangostationcontrol.common.lofar_logging import device_logging_to_python, log_exceptions diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_antennafield.py b/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_antennafield.py index eb400bf0b..f14a2838d 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_antennafield.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_antennafield.py @@ -7,12 +7,12 @@ # Distributed under the terms of the APACHE license. # See LICENSE.txt for more info. +import numpy + from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy from tangostationcontrol.devices.antennafield import AntennaQuality, AntennaUse from .base import AbstractTestBases -import numpy - class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase): def setUp(self): @@ -20,7 +20,6 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase): self.proxy.put_property({"RECV_devices": ["STAT/RECV/1"], "HBAT_Power_to_RECV_mapping": [1, 1, 1, 0] + [-1] * 92}) self.recv_proxy = self.setup_recv_proxy() - return self.proxy def setup_recv_proxy(self): # setup RECV @@ -37,7 +36,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase): def test_HBAT_ANT_mask_RW_configured_after_Antenna_Usage_Mask(self): """ Verify if HBAT_ANT_mask_RW values are correctly configured from Antenna_Usage_Mask values """ recv_proxy = self.setup_recv_proxy() - antennafield_proxy = self.setUp() + antennafield_proxy = self.proxy numpy.testing.assert_equal(numpy.array([True] * 96), recv_proxy.ANT_mask_RW) antenna_qualities = numpy.array([AntennaQuality.OK] * 96) @@ -57,7 +56,7 @@ class TestAntennaFieldDevice(AbstractTestBases.TestDeviceBase): def test_HBAT_ANT_mask_RW_configured_after_Antenna_Usage_Mask_only_one_functioning_antenna(self): """ Verify if HBAT_ANT_mask_RW values are correctly configured from Antenna_Usage_Mask values (only second antenna is OK)""" recv_proxy = self.setup_recv_proxy() - antennafield_proxy = self.setUp() + antennafield_proxy = self.proxy antenna_qualities = numpy.array([AntennaQuality.BROKEN] + [AntennaQuality.OK] + [AntennaQuality.BROKEN] * 94) antenna_use = numpy.array([AntennaUse.AUTO] * 96) antenna_properties = {'Antenna_Quality': antenna_qualities, 'Antenna_Use': antenna_use} -- GitLab