diff --git a/tangostationcontrol/tangostationcontrol/beam/delays.py b/tangostationcontrol/tangostationcontrol/beam/delays.py index b1d7f9976ec5de3e75784dac484c9c33584f2806..d3b674b3fcfaa0d8ff6047a8fde460ac2d885cee 100644 --- a/tangostationcontrol/tangostationcontrol/beam/delays.py +++ b/tangostationcontrol/tangostationcontrol/beam/delays.py @@ -6,7 +6,7 @@ def subtract(a, b): return numpy.array([x - y for x, y in zip(a, b)]) -class delay_calculator: +class Delays: def __init__(self, itrf: list([float])): """ Create a measure object, configured for the specified terrestrial location. """ diff --git a/tangostationcontrol/tangostationcontrol/devices/beam_device.py b/tangostationcontrol/tangostationcontrol/devices/beam_device.py index c8ccf78e649b194b9efd0a2e97231310cf091581..46f8ef4e01c56c4f88c3a8566afa33a85e354dfe 100644 --- a/tangostationcontrol/tangostationcontrol/devices/beam_device.py +++ b/tangostationcontrol/tangostationcontrol/devices/beam_device.py @@ -24,7 +24,7 @@ from tangostationcontrol.common.measures import get_measures_directory, get_avai from tangostationcontrol.common.lofar_logging import log_exceptions from tangostationcontrol.common.states import DEFAULT_COMMAND_STATES from tangostationcontrol.devices.device_decorators import TimeIt, only_in_states, fault_on_error -from tangostationcontrol.beam.delays import delay_calculator +from tangostationcontrol.beam.delays import Delays from tangostationcontrol.devices.lofar_device import lofar_device __all__ = ["beam_device", "main", "BeamTracker"] @@ -219,7 +219,7 @@ class beam_device(lofar_device): self.Beam_tracker = None # generic delay calculator to ask about validity of settings - self.generic_delay_calculator = delay_calculator([0, 0, 0]) + self.generic_delay_calculator = Delays([0, 0, 0]) # Derived classes will override this with a non-parameterised # version that lofar_device will call. diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/digitalbeam.py b/tangostationcontrol/tangostationcontrol/devices/sdp/digitalbeam.py index 256d156a4337bffb46e2ed085cbcc151d6d4f5b2..a0efcfad316ec4955b2bf5b34fd630cba01900ec 100644 --- a/tangostationcontrol/tangostationcontrol/devices/sdp/digitalbeam.py +++ b/tangostationcontrol/tangostationcontrol/devices/sdp/digitalbeam.py @@ -17,7 +17,7 @@ from tangostationcontrol.devices.beam_device import beam_device from tangostationcontrol.devices.sdp.beamlet import Beamlet from tangostationcontrol.devices.device_decorators import TimeIt from tangostationcontrol.common.lofar_logging import log_exceptions -from tangostationcontrol.beam.delays import delay_calculator +from tangostationcontrol.beam.delays import Delays import numpy import datetime @@ -137,7 +137,7 @@ class DigitalBeam(beam_device): input_itrf[input_nr] = antenna_itrf[antenna_nr] # a delay calculator - self.delay_calculator = delay_calculator(reference_itrf) + self.delay_calculator = Delays(reference_itrf) # relative positions of each antenna self.relative_input_positions = input_itrf - reference_itrf diff --git a/tangostationcontrol/tangostationcontrol/devices/tilebeam.py b/tangostationcontrol/tangostationcontrol/devices/tilebeam.py index d8e98ad75c550ed85b5d6a23cc0c8c7543637011..36b8b8a0db6c34221b20ff9c9fa13d3630dbff24 100644 --- a/tangostationcontrol/tangostationcontrol/devices/tilebeam.py +++ b/tangostationcontrol/tangostationcontrol/devices/tilebeam.py @@ -16,7 +16,7 @@ from tango import Util # Additional import from tangostationcontrol.common.entrypoint import entry from tangostationcontrol.common.lofar_logging import device_logging_to_python, log_exceptions -from tangostationcontrol.beam.delays import delay_calculator +from tangostationcontrol.beam.delays import Delays from tangostationcontrol.beam.hba_tile import NUMBER_OF_ELEMENTS_PER_TILE from tangostationcontrol.devices.beam_device import beam_device from tangostationcontrol.devices.device_decorators import TimeIt @@ -61,7 +61,7 @@ class TileBeam(beam_device): HBAT_antenna_itrf_offsets = self.antennafield_proxy.HBAT_antenna_itrf_offsets_R.reshape(self._nr_tiles, NUMBER_OF_ELEMENTS_PER_TILE, 3) # a delay calculator for each tile - self.HBAT_delay_calculators = [delay_calculator(reference_itrf) for reference_itrf in HBAT_reference_itrf] + self.HBAT_delay_calculators = [Delays(reference_itrf) for reference_itrf in HBAT_reference_itrf] # absolute positions of each antenna element self.HBAT_antenna_positions = [HBAT_reference_itrf[tile] + HBAT_antenna_itrf_offsets[tile] for tile in range(self._nr_tiles)] diff --git a/tangostationcontrol/tangostationcontrol/test/beam/test_delays.py b/tangostationcontrol/tangostationcontrol/test/beam/test_delays.py index 12d015774c933322495fc3aa7abe8d5c57052628..cba2a103db32526c04bbdeca0f370d74ef75aecd 100644 --- a/tangostationcontrol/tangostationcontrol/test/beam/test_delays.py +++ b/tangostationcontrol/tangostationcontrol/test/beam/test_delays.py @@ -4,7 +4,7 @@ import logging import numpy import numpy.testing -from tangostationcontrol.beam.delays import delay_calculator +from tangostationcontrol.beam.delays import Delays from tangostationcontrol.test import base @@ -15,12 +15,12 @@ class TestDelays(base.TestCase): """ reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5 - d = delay_calculator(reference_itrf) + d = Delays(reference_itrf) self.assertIsNotNone(d) def test_is_valid_direction(self): - d = delay_calculator([0, 0, 0]) + d = Delays([0, 0, 0]) # should accept base use cases self.assertTrue(d.is_valid_direction(("J2000", "0deg", "0deg"))) @@ -45,7 +45,7 @@ class TestDelays(base.TestCase): def test_sun(self): # # create a frame tied to the reference position reference_itrf = [3826577.066, 461022.948, 5064892.786] - d = delay_calculator(reference_itrf) + d = Delays(reference_itrf) for i in range(24): @@ -78,7 +78,7 @@ class TestDelays(base.TestCase): def test_identical_location(self): # # create a frame tied to the reference position reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5 - d = delay_calculator(reference_itrf) + d = Delays(reference_itrf) # set the antenna position identical to the reference position antenna_itrf = [[reference_itrf[0], reference_itrf[1], reference_itrf[2]]] # CS001LBA, in ITRF2005 epoch 2012.5 @@ -99,7 +99,7 @@ class TestDelays(base.TestCase): def test_regression(self): reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5 - d = delay_calculator(reference_itrf) + d = Delays(reference_itrf) # set the antenna position identical to the reference position antenna_itrf = [[3826923.503, 460915.488, 5064643.517]] # CS001LBA, in ITRF2005 epoch 2012.5 @@ -123,7 +123,7 @@ class TestDelays(base.TestCase): """ reference_itrf = [0, 0, 0] - d = delay_calculator(reference_itrf) + d = Delays(reference_itrf) # set the antenna position 0.1 lightsecond in the Z direction of the ITRF, # which is aligned with the North Pole, see @@ -145,7 +145,7 @@ class TestDelays(base.TestCase): self.assertAlmostEqual(0.1, delays[0], 6, f"delays[0] = {delays[0]}") def test_convert_bulk(self): - d = delay_calculator([0, 0, 0]) + d = Delays([0, 0, 0]) timestamp = datetime.datetime(2022, 3, 1, 0, 0, 0) # timestamp does not actually matter, but casacore doesn't know that. d.set_measure_time(timestamp) @@ -166,7 +166,7 @@ class TestDelays(base.TestCase): numpy.testing.assert_almost_equal(single_pos_result[0, :], bulk_result[i, :], 4) def test_convert_bulk_speed(self): - d = delay_calculator([0, 0, 0]) + d = Delays([0, 0, 0]) timestamp = datetime.datetime(2022, 3, 1, 0, 0, 0) # timestamp does not actually matter, but casacore doesn't know that. d.set_measure_time(timestamp)