Skip to content
Snippets Groups Projects
Commit 678355ed authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'L2SS-239-Add_waveform_CP/MP_to_SDP_device' into 'master'

Resolve L2SS-239 "Add waveform cp/mp to sdp device"

Closes L2SS-239

See merge request !102
parents 439cab71 7dc27c48
Branches
Tags
1 merge request!102Resolve L2SS-239 "Add waveform cp/mp to sdp device"
......@@ -103,7 +103,7 @@ class SDP(hardware_device):
FPGA_wg_frequency_R = attribute_wrapper(comms_annotation=["2:FPGA_wg_frequency_R"], datatype=numpy.float_, dims=(12, 16))
FPGA_wg_frequency_RW = attribute_wrapper(comms_annotation=["2:FPGA_wg_frequency_RW"], datatype=numpy.float_, dims=(12, 16), access=AttrWriteType.READ_WRITE)
FPGA_wg_phase_R = attribute_wrapper(comms_annotation=["2:FPGA_wg_phase_R"], datatype=numpy.float_, dims=(12, 16))
FPGA_wg_phase_RW = attribute_wrapper(comms_annotation=["2:FPGA_wg_phase_R"], datatype=numpy.float_, dims=(12, 16), access=AttrWriteType.READ_WRITE)
FPGA_wg_phase_RW = attribute_wrapper(comms_annotation=["2:FPGA_wg_phase_RW"], datatype=numpy.float_, dims=(12, 16), access=AttrWriteType.READ_WRITE)
TR_fpga_mask_R = attribute_wrapper(comms_annotation=["2:TR_fpga_mask_R"], datatype=numpy.bool_, dims=(16,))
TR_fpga_mask_RW = attribute_wrapper(comms_annotation=["2:TR_fpga_mask_RW"], datatype=numpy.bool_, dims=(16,), access=AttrWriteType.READ_WRITE)
TR_fpga_communication_error_R = attribute_wrapper(comms_annotation=["2:TR_fpga_communication_error_R"], datatype=numpy.bool_, dims=(16,))
......
%% Cell type:code id:waiting-chance tags:
``` python
import time
```
%% Cell type:code id:moving-alexandria tags:
``` python
d=DeviceProxy("LTS/SDP/1")
```
%% Cell type:code id:ranking-aluminum tags:
``` python
state = str(d.state())
if state == "OFF":
if state == "OFF" or state == "FAULT":
d.initialise()
time.sleep(1)
state = str(d.state())
if state == "STANDBY":
d.on()
state = str(d.state())
if state == "ON":
print("Device is now in on state")
else:
print("warning, expected device to be in on state, is: ", state)
```
%% Output
warning, expected device to be in on state, is: FAULT
---------------------------------------------------------------------------
ConnectionFailed Traceback (most recent call last)
/tmp/ipykernel_21/3603531217.py in <module>
----> 1 state = str(d.state())
2
3
4 if state == "OFF" or state == "FAULT":
5 d.initialise()
/usr/local/lib/python3.7/dist-packages/tango/green.py in greener(obj, *args, **kwargs)
193 green_mode = access('green_mode', None)
194 executor = get_object_executor(obj, green_mode)
--> 195 return executor.run(fn, args, kwargs, wait=wait, timeout=timeout)
196
197 return greener
/usr/local/lib/python3.7/dist-packages/tango/green.py in run(self, fn, args, kwargs, wait, timeout)
107 # Sychronous (no delegation)
108 if not self.asynchronous or not self.in_executor_context():
--> 109 return fn(*args, **kwargs)
110 # Asynchronous delegation
111 accessor = self.delegate(fn, *args, **kwargs)
/usr/local/lib/python3.7/dist-packages/tango/device_proxy.py in __DeviceProxy__state(self, *args, **kwargs)
1558 if dev_st == DevState.ON : ...
1559 """
-> 1560 return self._state(*args, **kwargs)
1561
1562
ConnectionFailed: DevFailed[
DevError[
desc = TRANSIENT CORBA system exception: TRANSIENT_NoUsableProfile
origin = Connection::connect
reason = API_CorbaException
severity = ERR]
DevError[
desc = Failed to connect to device lts/sdp/1
origin = Connection::connect
reason = API_CantConnectToDevice
severity = ERR]
]
%% Cell type:code id:transsexual-battle tags:
``` python
values = [
[d.FPGA_mask_RW, "FPGA_mask_RW"],
[d.FPGA_scrap_R, "FPGA_scrap_R"],
[d.FPGA_scrap_RW, "FPGA_scrap_RW"],
[d.FPGA_status_R, "FPGA_status_R"],
[d.FPGA_temp_R, "FPGA_temp_R"],
[d.FPGA_version_R, "FPGA_version_R"],
[d.FPGA_weights_R, "FPGA_weights_R"],
[d.FPGA_weights_RW, "FPGA_weights_RW"],
[d.TR_busy_R, "TR_busy_R"],
[d.TR_reload_RW, "TR_reload_RW"],
# [d.TR_tod_R, "TR_tod_R"],
# [d.TR_uptime_R, "TR_uptime_R"]
]
for i in values:
print("🟦🟦🟦", i[1], ": ", i[0])
```
%% Cell type:code id:eligible-times tags:
``` python
attr_names = d.get_attribute_list()
for i in attr_names:
exec("value = print(i, d.{})".format(i))
```
%% Output
---------------------------------------------------------------------------
DevFailed Traceback (most recent call last)
<ipython-input-5-e44d5c52394a> in <module>
----> 1 d.TR_tod_R
/tmp/ipykernel_22/2885399456.py in <module>
1 values = [
----> 2 [d.FPGA_mask_RW, "FPGA_mask_RW"],
3 [d.FPGA_scrap_R, "FPGA_scrap_R"],
4 [d.FPGA_scrap_RW, "FPGA_scrap_RW"],
5 [d.FPGA_status_R, "FPGA_status_R"],
/usr/local/lib/python3.7/dist-packages/tango/device_proxy.py in __DeviceProxy__getattr(self, name)
319 attr_info = self.__get_attr_cache().get(name_l)
320 if attr_info:
--> 321 return __get_attribute_value(self, attr_info, name)
322
323 if name_l in self.__get_pipe_cache():
/usr/local/lib/python3.7/dist-packages/tango/device_proxy.py in __get_attribute_value(self, attr_info, name)
281 def __get_attribute_value(self, attr_info, name):
282 _, enum_class = attr_info
--> 283 attr_value = self.read_attribute(name).value
284 if enum_class:
285 return enum_class(attr_value)
/usr/local/lib/python3.7/dist-packages/tango/green.py in greener(obj, *args, **kwargs)
193 green_mode = access('green_mode', None)
194 executor = get_object_executor(obj, green_mode)
--> 195 return executor.run(fn, args, kwargs, wait=wait, timeout=timeout)
196
197 return greener
/usr/local/lib/python3.7/dist-packages/tango/green.py in run(self, fn, args, kwargs, wait, timeout)
107 # Sychronous (no delegation)
108 if not self.asynchronous or not self.in_executor_context():
--> 109 return fn(*args, **kwargs)
110 # Asynchronous delegation
111 accessor = self.delegate(fn, *args, **kwargs)
/usr/local/lib/python3.7/dist-packages/tango/device_proxy.py in __DeviceProxy__read_attribute(self, value, extract_as)
439
440 def __DeviceProxy__read_attribute(self, value, extract_as=ExtractAs.Numpy):
--> 441 return __check_read_attribute(self._read_attribute(value, extract_as))
442
443
/usr/local/lib/python3.7/dist-packages/tango/device_proxy.py in __check_read_attribute(dev_attr)
155 def __check_read_attribute(dev_attr):
156 if dev_attr.has_failed:
--> 157 raise DevFailed(*dev_attr.get_err_stack())
158 return dev_attr
159
DevFailed: DevFailed[
DevError[
desc = TypeError: Expecting a numeric type, but it is not. If you use a numpy type instead of python core types, then it must exactly match (ex: numpy.int32 for PyTango.DevLong)
origin = Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/tango/server.py", line 138, in read_attr
set_complex_value(attr, ret)
File "/usr/local/lib/python3.7/dist-packages/tango/server.py", line 115, in set_complex_value
attr.set_value(value)
TypeError: Expecting a numeric type, but it is not. If you use a numpy type instead of python core types, then it must exactly match (ex: numpy.int32 for PyTango.DevLong)
reason = PyDs_PythonError
desc = Read value for attribute FPGA_mask_RW has not been updated
origin = Device_3Impl::read_attributes_no_except
reason = API_AttrValueNotSet
severity = ERR]
DevError[
desc = Failed to read_attribute on device lts/sdp/1, attribute TR_tod_R
desc = Failed to read_attribute on device lts/sdp/1, attribute FPGA_mask_RW
origin = DeviceProxy::read_attribute()
reason = API_AttributeFailed
severity = ERR]
]
%% Cell type:code id:7accae6a tags:
``` python
attr_names = d.get_attribute_list()
for i in attr_names:
exec("value = print(i, d.{})".format(i))
```
%% Cell type:code id:b88868c5 tags:
``` python
wgswitches = d.FPGA_wg_enable_R
print("Old values:\n", wgswitches)
wgswitches[9][0] = True
wgswitches[10][0] = True
print("Values to be set:\n", wgswitches)
d.FPGA_wg_enable_RW =wgswitches
time.sleep(7)
print("Values read back after setting:\n",d.FPGA_wg_enable_R)
```
%% Output
array([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]],
dtype=float32)
%% Cell type:code id:8f3db8c7 tags:
``` python
phases = d.FPGA_wg_phase_R
print("Old values:\n", phases)
phases[9][0] = 1.0334
phases[9][1] = 20.15
phases[10][0] = 130
print("Values to be set:\n", phases)
d.FPGA_wg_phase_RW = phases
time.sleep(7)
print("Values read back after setting:\n", d.FPGA_wg_phase_R)
```
%% Output
array([[119.99817, 119.99817, 119.99817, 119.99817, 119.99817, 119.99817,
119.99817, 119.99817, 119.99817, 119.99817, 119.99817, 119.99817,
119.99817, 119.99817, 119.99817, 119.99817],
[119.99817, 119.99817, 119.99817, 119.99817, 119.99817, 119.99817,
119.99817, 119.99817, 119.99817, 119.99817, 119.99817, 119.99817,
119.99817, 119.99817, 119.99817, 119.99817],
[119.99817, 119.99817, 119.99817, 119.99817, 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ]], dtype=float32)
%% Cell type:code id:e45b4874 tags:
``` python
amplitudes = d.FPGA_wg_amplitude_R
print("Old values:\n", amplitudes)
amplitudes[9][0] = 1.0
amplitudes[9][1] = 1.99
amplitudes[10][0] = 0.5
print("Values to be set:\n", amplitudes)
d.FPGA_wg_amplitude_RW = amplitudes
time.sleep(7)
print("Values read back after setting:\n", d.FPGA_wg_amplitude_R)
```
%% Output
array([[29921878., 29921878., 29921878., 29921878., 29921878., 29921878.,
29921878., 29921878., 29921878., 29921878., 29921878., 29921878.,
29921878., 29921878., 29921878., 29921878.],
[29921878., 29921878., 29921878., 29921878., 29921878., 29921878.,
29921878., 29921878., 29921878., 29921878., 29921878., 29921878.,
29921878., 29921878., 29921878., 29921878.],
[29921878., 29921878., 29921878., 29921878., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.]], dtype=float32)
%% Cell type:code id:9b1bbd3e tags:
``` python
frequencies = d.FPGA_wg_frequency_R
print("Old values:\n", frequencies)
frequencies[9][0] = 19000000
frequencies[9][1] = 20000000
frequencies[10][0] = 22000000
print("Values to be set:\n", frequencies)
d.FPGA_wg_frequency_RW = frequencies
print("Values read back after setting:\n", d.FPGA_wg_frequency_R)
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment