diff --git a/tangostationcontrol/tangostationcontrol/devices/beam.py b/tangostationcontrol/tangostationcontrol/devices/beam.py index 771358b442f4a3b18919510a98bd603c9f90f306..8deea16d814166a54a43791fccd9911f0a782f29 100644 --- a/tangostationcontrol/tangostationcontrol/devices/beam.py +++ b/tangostationcontrol/tangostationcontrol/devices/beam.py @@ -10,7 +10,7 @@ import numpy import datetime from tango.server import attribute, command, device_property -from tango import AttrWriteType, DebugIt, DevState, DeviceProxy, DevVarStringArray, DevVarFloatArray, DevVarLong64Array, DevVarDoubleArray +from tango import AttrWriteType, AttrDataFormat, DebugIt, DevState, DeviceProxy, DevVarStringArray, DevVarFloatArray, DevVarLong64Array, DevVarDoubleArray # Additional import from tangostationcontrol.common.entrypoint import entry @@ -30,7 +30,7 @@ __all__ = ["Beam", "main"] class Beam(lofar_device): _hbat_pointing_direction = numpy.zeros((96,3), dtype=numpy.str) - _hbat_pointing_epoch = numpy.zeros(96, dtype=numpy.double) + _hbat_pointing_timestamp = numpy.zeros(96, dtype=numpy.double) # ----------------- # Device Properties @@ -38,13 +38,13 @@ class Beam(lofar_device): reference_itrf = device_property( dtype='DevVarFloatArray', mandatory=False, - default_value = numpy.tile(numpy.array([3826577.066, 461022.948, 5064892.786]),(96,1)) # CS002LBA, in ITRF2005 epoch 2012.5 + default_value = numpy.tile(numpy.array([3826577.066, 461022.948, 5064892.786]),(96,1)) # CS002LBA, in ITRF2005 timestamp 2012.5 ) antenna_itrf = device_property( dtype='DevVarFloatArray', mandatory=False, - default_value = numpy.tile(numpy.array([3826923.546, 460915.441, 5064643.489]),(96,16,1)) # CS001LBA, in ITRF2005 epoch 2012.5 + default_value = numpy.tile(numpy.array([3826923.546, 460915.441, 5064643.489]),(96,16,1)) # CS001LBA, in ITRF2005 timestamp 2012.5 ) # ---------- @@ -55,9 +55,9 @@ class Beam(lofar_device): dtype=((numpy.str,),), max_dim_x=3, max_dim_y=96, fget=lambda self: self._hbat_pointing_direction) - HBAT_pointing_epoch_R = attribute(access=AttrWriteType.READ, + HBAT_pointing_timestamp_R = attribute(access=AttrWriteType.READ, dtype=(numpy.double,), max_dim_x=96, - fget=lambda self: self._hbat_pointing_epoch) + fget=lambda self: self._hbat_pointing_timestamp) RECV_name = 'stat/recv/1' @@ -134,7 +134,7 @@ class Beam(lofar_device): for tile in range(96): if mask[tile]: self._hbat_pointing_direction[tile] = pointing_direction[tile] - self._hbat_pointing_epoch[tile] = timestamp + self._hbat_pointing_timestamp[tile] = timestamp # -------- # Commands @@ -171,7 +171,7 @@ class Beam(lofar_device): logger.warning("Restarting device to activate new measures tables") restart_python() - @command(dtype_in=DevVarStringArray, dtype_out=DevVarDoubleArray) + @command(dtype_in=DevVarStringArray, dformat_in=AttrDataFormat.IMAGE, dtype_out=DevVarDoubleArray) @DebugIt() @log_exceptions() @only_in_states([DevState.ON]) diff --git a/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py b/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py index d71deb12afb881b39583475abb9039bc226e3773..8db5c40bc43900e74c8d253d79ab84d35f7b07f0 100644 --- a/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py +++ b/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py @@ -39,12 +39,12 @@ class TestBeamDevice(base.TestCase): self.assertEqual(96, len(proxy.read_attribute( "HBAT_pointing_direction_R").value)) - def test_get_pointing_epochs(self): - """Verify can read epochs attribute and length matches without err""" + def test_get_pointing_timestamps(self): + """Verify can read timestamps attribute and length matches without err""" with DeviceTestContext(beam.Beam, process=True) as proxy: self.assertEqual(96, len(proxy.read_attribute( - "HBAT_pointing_epoch_R").value)) + "HBAT_pointing_timestamp_R").value)) def test_HBAT_delays_dims(self): """Verify HBAT delays are retrieved with correct dimensions""" @@ -57,7 +57,7 @@ class TestBeamDevice(base.TestCase): self.assertEqual(DevState.ON, proxy.state()) # verify HBAT_delays method returns the correct dimensions - HBAT_delays = proxy.HBAT_delays(["J2000","0deg","0deg"] * 96) + HBAT_delays = proxy.HBAT_delays([["J2000","0deg","0deg"]] * 96) self.assertEqual((96*16,), HBAT_delays.shape) def test_HBAT_delays_calculations(self): @@ -71,6 +71,6 @@ class TestBeamDevice(base.TestCase): self.assertEqual(DevState.ON, proxy.state()) # verify if values are actually transformed - HBAT_delays = proxy.HBAT_delays(["J2000","0deg","0deg"] * 96) + HBAT_delays = proxy.HBAT_delays([["J2000","0deg","0deg"]] * 96) HBAT_bf_delays = proxy.calculate_HBAT_bf_delays(HBAT_delays) self.assertNotEqual(HBAT_delays, HBAT_bf_delays)