Skip to content
Snippets Groups Projects
Commit 009060b6 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-578: fix integration test

parent 5d950448
No related branches found
No related tags found
1 merge request!228Resolve L2SS-578 "Precise hbat delay steps"
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
# See LICENSE.txt for more info. # See LICENSE.txt for more info.
import numpy import numpy
from tango.test_context import DeviceTestContext
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from tangostationcontrol.devices import beam
from .base import AbstractTestBases from .base import AbstractTestBases
...@@ -19,33 +22,35 @@ class TestDeviceBeam(AbstractTestBases.TestDeviceBase): ...@@ -19,33 +22,35 @@ class TestDeviceBeam(AbstractTestBases.TestDeviceBase):
def test_write_HBAT_delays(self): def test_write_HBAT_delays(self):
""" Test whether the delay values are correctly saved into the relative RECV attribute""" """ 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)
# 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 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment