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 @@
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])
......
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment