From b87c2d11c607d4be7542624547e9f0a7b2c99b14 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Tue, 25 Jan 2022 17:30:44 +0100 Subject: [PATCH] L2SS-480: Made calculate_HBAT_bf_delays static to avoid needing to expose it as a command. The function does not depend on the actual device. --- .../tangostationcontrol/devices/beam.py | 19 ++----------------- .../test/devices/test_beam_device.py | 2 +- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/devices/beam.py b/tangostationcontrol/tangostationcontrol/devices/beam.py index e4a85594a..bb5d962c5 100644 --- a/tangostationcontrol/tangostationcontrol/devices/beam.py +++ b/tangostationcontrol/tangostationcontrol/devices/beam.py @@ -98,7 +98,8 @@ class Beam(lofar_device): return delays - def _calculate_HBAT_bf_delays(self, delays: numpy.ndarray): + @staticmethod + def _calculate_HBAT_bf_delays(delays: numpy.ndarray): """ Helper function that converts a signal path delay (in seconds) to an analog beam weight, which is a value per tile per dipole per polarisation. @@ -181,22 +182,6 @@ class Beam(lofar_device): return delays.flatten() - @command(dtype_in=DevVarFloatArray, dtype_out=DevVarLong64Array) - @DebugIt() - @log_exceptions() - @only_in_states([DevState.ON]) - def calculate_HBAT_bf_delays(self, delays: numpy.ndarray): - """ - Helper function that converts a signal path delay (in seconds) to an analog beam weight, - which is a value per tile per dipole per polarisation. - """ - - delays = delays.reshape(96,16) - - result = self._calculate_HBAT_bf_delays(delays) - - return result.flatten() - @command(dtype_in=DevVarStringArray) @DebugIt() @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 74bdf3eec..bb89efc7a 100644 --- a/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py +++ b/tangostationcontrol/tangostationcontrol/test/devices/test_beam_device.py @@ -78,5 +78,5 @@ class TestBeamDevice(base.TestCase): # verify if values are actually transformed HBAT_delays = proxy.HBAT_delays(numpy.array([["J2000","0deg","0deg"]] * 96).flatten()) - HBAT_bf_delays = proxy.calculate_HBAT_bf_delays(HBAT_delays) + HBAT_bf_delays = beam.Beam._calculate_HBAT_bf_delays(HBAT_delays) self.assertNotEqual(HBAT_delays, HBAT_bf_delays) -- GitLab