From be06a7e47607859370e886a0162b0305f8bd0d7c Mon Sep 17 00:00:00 2001 From: stedif <stefano.difrischia@inaf.it> Date: Thu, 31 Mar 2022 15:37:08 +0200 Subject: [PATCH] L2SS-643: add calculate_bf_weights command --- .../devices/sdp/beamlet.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py b/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py index e3eebee2b..e49072244 100644 --- a/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py +++ b/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py @@ -8,10 +8,10 @@ """ # PyTango imports -from tango.server import device_property -from tango import AttrWriteType -# Additional import +from tango.server import device_property, command +from tango import AttrWriteType, DevVarFloatArray, DevVarULongArray +# Additional import from tangostationcontrol.common.entrypoint import entry from tangostationcontrol.clients.attribute_wrapper import attribute_wrapper from tangostationcontrol.devices.opcua_device import opcua_device @@ -130,9 +130,23 @@ class Beamlet(opcua_device): # Overloaded functions # -------- + # -------- + # internal functions + # -------- + def _calculate_bf_weights(self, phases: numpy.ndarray): + pass + # -------- # Commands # -------- + @command(dtype_in=DevVarFloatArray, dtype_out=DevVarULongArray) + def calculate_bf_weights(self, phases: numpy.ndarray): + """ converts a difference in phase (in radiants) to a FPGA weight (in complex number) """ + + # Calculate the FPGA weight array + bf_weights = self._calculate_bf_weights(phases) + + return bf_weights # ---------- # Run server -- GitLab