Skip to content
Snippets Groups Projects
Commit 4b266211 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-380: epoch -> timestamp is better naming

parent 253fcc12
No related branches found
No related tags found
1 merge request!220Resolve L2SS-480 "Delays to beam weights"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
import numpy import numpy
import datetime import datetime
from tango.server import attribute, command, device_property 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 # Additional import
from tangostationcontrol.common.entrypoint import entry from tangostationcontrol.common.entrypoint import entry
...@@ -30,7 +30,7 @@ __all__ = ["Beam", "main"] ...@@ -30,7 +30,7 @@ __all__ = ["Beam", "main"]
class Beam(lofar_device): class Beam(lofar_device):
_hbat_pointing_direction = numpy.zeros((96,3), dtype=numpy.str) _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 # Device Properties
...@@ -38,13 +38,13 @@ class Beam(lofar_device): ...@@ -38,13 +38,13 @@ class Beam(lofar_device):
reference_itrf = device_property( reference_itrf = device_property(
dtype='DevVarFloatArray', dtype='DevVarFloatArray',
mandatory=False, 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( antenna_itrf = device_property(
dtype='DevVarFloatArray', dtype='DevVarFloatArray',
mandatory=False, 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): ...@@ -55,9 +55,9 @@ class Beam(lofar_device):
dtype=((numpy.str,),), max_dim_x=3, max_dim_y=96, dtype=((numpy.str,),), max_dim_x=3, max_dim_y=96,
fget=lambda self: self._hbat_pointing_direction) 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, 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' RECV_name = 'stat/recv/1'
...@@ -134,7 +134,7 @@ class Beam(lofar_device): ...@@ -134,7 +134,7 @@ class Beam(lofar_device):
for tile in range(96): for tile in range(96):
if mask[tile]: if mask[tile]:
self._hbat_pointing_direction[tile] = pointing_direction[tile] self._hbat_pointing_direction[tile] = pointing_direction[tile]
self._hbat_pointing_epoch[tile] = timestamp self._hbat_pointing_timestamp[tile] = timestamp
# -------- # --------
# Commands # Commands
...@@ -171,7 +171,7 @@ class Beam(lofar_device): ...@@ -171,7 +171,7 @@ class Beam(lofar_device):
logger.warning("Restarting device to activate new measures tables") logger.warning("Restarting device to activate new measures tables")
restart_python() restart_python()
@command(dtype_in=DevVarStringArray, dtype_out=DevVarDoubleArray) @command(dtype_in=DevVarStringArray, dformat_in=AttrDataFormat.IMAGE, dtype_out=DevVarDoubleArray)
@DebugIt() @DebugIt()
@log_exceptions() @log_exceptions()
@only_in_states([DevState.ON]) @only_in_states([DevState.ON])
......
...@@ -39,12 +39,12 @@ class TestBeamDevice(base.TestCase): ...@@ -39,12 +39,12 @@ class TestBeamDevice(base.TestCase):
self.assertEqual(96, len(proxy.read_attribute( self.assertEqual(96, len(proxy.read_attribute(
"HBAT_pointing_direction_R").value)) "HBAT_pointing_direction_R").value))
def test_get_pointing_epochs(self): def test_get_pointing_timestamps(self):
"""Verify can read epochs attribute and length matches without err""" """Verify can read timestamps attribute and length matches without err"""
with DeviceTestContext(beam.Beam, process=True) as proxy: with DeviceTestContext(beam.Beam, process=True) as proxy:
self.assertEqual(96, len(proxy.read_attribute( self.assertEqual(96, len(proxy.read_attribute(
"HBAT_pointing_epoch_R").value)) "HBAT_pointing_timestamp_R").value))
def test_HBAT_delays_dims(self): def test_HBAT_delays_dims(self):
"""Verify HBAT delays are retrieved with correct dimensions""" """Verify HBAT delays are retrieved with correct dimensions"""
...@@ -57,7 +57,7 @@ class TestBeamDevice(base.TestCase): ...@@ -57,7 +57,7 @@ class TestBeamDevice(base.TestCase):
self.assertEqual(DevState.ON, proxy.state()) self.assertEqual(DevState.ON, proxy.state())
# verify HBAT_delays method returns the correct dimensions # 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) self.assertEqual((96*16,), HBAT_delays.shape)
def test_HBAT_delays_calculations(self): def test_HBAT_delays_calculations(self):
...@@ -71,6 +71,6 @@ class TestBeamDevice(base.TestCase): ...@@ -71,6 +71,6 @@ class TestBeamDevice(base.TestCase):
self.assertEqual(DevState.ON, proxy.state()) self.assertEqual(DevState.ON, proxy.state())
# verify if values are actually transformed # 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) HBAT_bf_delays = proxy.calculate_HBAT_bf_delays(HBAT_delays)
self.assertNotEqual(HBAT_delays, HBAT_bf_delays) self.assertNotEqual(HBAT_delays, HBAT_bf_delays)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment