diff --git a/tangostationcontrol/tangostationcontrol/integration_test/devices/test_device_beam.py b/tangostationcontrol/tangostationcontrol/integration_test/devices/test_device_beam.py index 6f98df8b1864dea700b631f97916f2414f15ea40..c83e0af39512c4acf7dd0aa4c31bf6127ffd318b 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/devices/test_device_beam.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/devices/test_device_beam.py @@ -8,10 +8,7 @@ # See LICENSE.txt for more info. import numpy -from tango.test_context import DeviceTestContext - from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy -from tangostationcontrol.devices import beam from .base import AbstractTestBases @@ -22,35 +19,39 @@ class TestDeviceBeam(AbstractTestBases.TestDeviceBase): def test_write_HBAT_delays(self): """ Test whether the delay values are correctly saved into the relative RECV attribute""" - with DeviceTestContext(beam.Beam, process=True) as proxy: - - proxy.initialise() - proxy.on() - - # setup RECV as well - recv_proxy = TestDeviceProxy("STAT/RECV/1") - recv_proxy.off() - recv_proxy.initialise() - recv_proxy.set_defaults() - recv_proxy.on() - - proxy.recv_proxy = recv_proxy - - # Verify attribute is present (all zeros if never used before) - HBAT_delays_r1 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delays_RW').value) - self.assertIsNotNone(HBAT_delays_r1) - - # verify if values are actually transformed - HBAT_delays_flat = proxy.HBAT_delays(numpy.array([["J2000","0deg","0deg"]] * 96).flatten()) - HBAT_delays = numpy.array(HBAT_delays_flat).reshape(96,16) - HBAT_signal_input_delays = numpy.zeros((96,32), dtype=numpy.float64) # Property of Beam-device - HBAT_bf_delay_step_delays = recv_proxy.HBAT_bf_delay_step_delays - - HBAT_bf_delays = beam.Beam._calculate_HBAT_bf_delays(HBAT_delays, HBAT_signal_input_delays, HBAT_bf_delay_step_delays) - self.assertNotEqual(HBAT_delays, HBAT_bf_delays) - - # Verify writing operation does not lead to errors - proxy.HBAT_set_pointing(numpy.array([["J2000","0deg","0deg"]] * 96).flatten()) # write values to RECV - HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delays_RW').value) - self.assertIsNotNone(HBAT_delays_r2) + self.proxy.initialise() + self.proxy.on() + + # setup RECV as well + recv_proxy = TestDeviceProxy("STAT/RECV/1") + recv_proxy.off() + recv_proxy.initialise() + recv_proxy.set_defaults() + recv_proxy.on() + + self.proxy.recv_proxy = recv_proxy + + # Verify attribute is present (all zeros if never used before) + HBAT_delays_r1 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delays_RW').value) + self.assertIsNotNone(HBAT_delays_r1) + + # Unable to independently test '_calculate_HBAT_bf_delays' because it is not a Tango command, + # thus DeviceProxy cannot access it. On the other hand, the method cannot be unit-tested because it + # requires access to a DeviceRecv property from DeviceBeam. This last requirement should change with L2SS-574 + # + # verify if values are actually transformed + # HBAT_delays_flat = self.proxy.HBAT_delays(numpy.array([["J2000","0deg","0deg"]] * 96).flatten()) + # HBAT_delays = numpy.array(HBAT_delays_flat).reshape(96,16) + # HBAT_signal_input_delays = numpy.zeros((96,32), dtype=numpy.float64) # Property of Beam-device + # HBAT_bf_delay_step_delays = recv_proxy.HBAT_bf_delay_step_delays + # HBAT_bf_delays = self.proxy._calculate_HBAT_bf_delays(HBAT_delays, HBAT_signal_input_delays, HBAT_bf_delay_step_delays) + # self.assertNotEqual(HBAT_delays, HBAT_bf_delays) + + # Verify writing operation does not lead to errors + self.proxy.HBAT_set_pointing(numpy.array([["J2000","0deg","0deg"]] * 96).flatten()) # write values to RECV + HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delays_RW').value) + self.assertIsNotNone(HBAT_delays_r2) + + # Verify delays changed (to be discussed) + #self.assertFalse((HBAT_delays_r1==HBAT_delays_r2).all())