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

Merge branch 'master' into L2SS-480-delays-to-beam-weights

parents 4b50e2cf b4961cf8
No related branches found
No related tags found
1 merge request!220Resolve L2SS-480 "Delays to beam weights"
from delays import *
import pprint
if __name__ == '__main__':
# # create a frame tied to the reference position
......@@ -19,5 +20,47 @@ if __name__ == '__main__':
delays = d.convert(direction, antenna_itrf)
# print the delays
import pprint
pprint.pprint(delays)
# pprint.pprint(delays)
#test changing the time
print(f"Changing timestamp test\nBase parametres: Direction: {direction}, position: {antenna_itrf}")
for i in range(10):
# # set the timestamp to solve for
timestamp = datetime.datetime(2021,1,1,0,i,5)
d.set_measure_time(timestamp)
delays = d.convert(direction, antenna_itrf)
# print the delays
print(f"Timestamp: {timestamp}: {delays}")
# reset time
timestamp = datetime.datetime(2021, 1, 1, 0, 0, 5)
d.set_measure_time(timestamp)
#test changing the antenna position
print(f"Changing Antenna position test.\nBase parametres: Time: {timestamp} Direction: {direction}")
for i in range(10):
antenna_itrf = [[3826577.066 + i, 461022.948, 5064892.786]] # CS002LBA, in ITRF2005 epoch 2012.5
delays = d.convert(direction, antenna_itrf)
# print the delays
print(f"Antenna position: {antenna_itrf}: {delays}")
# test changing the direction
antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5
print(f"Changing direction test.\nBase parametres: Time: {timestamp} , position: {antenna_itrf}")
for i in range(10):
direction = "J2000", f"{i}deg", "0deg"
delays = d.convert(direction, antenna_itrf)
# print the delays
print(f"Direction: {direction}: {delays}")
......@@ -19,10 +19,15 @@ from tango.server import DeviceMeta
logger = logging.getLogger()
class AbstractDeviceMetas(DeviceMeta, ABCMeta):
# TODO(Corne): Fix combining metaclasses by iterating over their variables and
# methods. https://support.astron.nl/jira/browse/L2SS-551
# class AbstractDeviceMetas(DeviceMeta, ABCMeta):
class AbstractDeviceMetas(DeviceMeta):
"""Collects meta classes to allow lofar_device to be both a Device and an ABC. """
def __new__(mcs, name, bases, namespace, **kwargs):
cls = ABCMeta.__new__(mcs, name, bases, namespace, **kwargs)
cls = DeviceMeta.__new__(type(cls), name, bases, namespace)
cls = DeviceMeta.__new__(mcs, name, bases, namespace, **kwargs)
# temp_cls = ABCMeta.__new__(mcs, name, bases, namespace)
# setattr(cls, '__abstractmethods__', temp_cls.__abstractmethods__)
# setattr(cls, '_abc_impl', temp_cls._abc_impl)
return cls
......@@ -11,7 +11,7 @@
"""
from abc import ABCMeta, abstractmethod
from abc import abstractmethod
# PyTango imports
from tango.server import device_property, attribute
......@@ -33,7 +33,9 @@ import numpy
__all__ = ["Statistics"]
class Statistics(opcua_device, metaclass=ABCMeta):
# TODO(Corne): Make Statistics use ABCMeta again when L2SS-551 is fixed
# https://support.astron.nl/jira/browse/L2SS-551
class Statistics(opcua_device):
# In derived classes, set this to a subclass of StatisticsCollector
@property
......
......@@ -12,6 +12,7 @@ import unittest
from tango._tango import DevState
from tangostationcontrol.devices.opcua_device import opcua_device
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
from tangostationcontrol.integration_test import base
......@@ -55,6 +56,12 @@ class AbstractTestBases:
self.assertEqual(DevState.STANDBY, self.proxy.state())
def test_device_missing_attributes(self):
"""Test if any attributes are missing from opcua devices"""
if isinstance(self.proxy, opcua_device):
self.self.assertListEqual([], self.proxy.opcua_missing_attributes_R)
def test_device_on(self):
"""Test if we can transition to on"""
......
......@@ -86,4 +86,9 @@ class TestAbstractDevice(base.TestCase):
# the expected error.
self.assertRaises(TypeError, self.AbstractExample)
@mock.patch.object(server, 'get_worker')
@mock.patch.object(server, 'LatestDeviceImpl')
def test_isinstance(self, m_worker, m_implement):
m_device = self.TestHardwareDevice(mock.Mock(), mock.Mock())
self.assertFalse(isinstance(m_device, AbstractDeviceMetas))
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