ophyd-async 0.13.4__py3-none-any.whl → 0.13.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ophyd_async/_version.py +2 -2
- ophyd_async/core/__init__.py +24 -2
- ophyd_async/core/_derived_signal_backend.py +2 -1
- ophyd_async/core/_detector.py +2 -2
- ophyd_async/core/_device.py +9 -9
- ophyd_async/core/_enums.py +5 -0
- ophyd_async/core/_signal.py +34 -38
- ophyd_async/core/_signal_backend.py +3 -1
- ophyd_async/core/_status.py +2 -2
- ophyd_async/core/_utils.py +11 -11
- ophyd_async/epics/adcore/_utils.py +4 -4
- ophyd_async/epics/core/_aioca.py +2 -2
- ophyd_async/epics/core/_p4p.py +2 -2
- ophyd_async/epics/motor.py +28 -7
- ophyd_async/sim/_motor.py +4 -2
- ophyd_async/sim/_stage.py +14 -4
- ophyd_async/tango/core/__init__.py +17 -3
- ophyd_async/tango/core/_signal.py +18 -22
- ophyd_async/tango/core/_tango_transport.py +407 -239
- ophyd_async/tango/core/_utils.py +9 -0
- ophyd_async/tango/demo/_mover.py +1 -2
- ophyd_async/tango/testing/__init__.py +2 -1
- ophyd_async/tango/testing/_one_of_everything.py +13 -5
- ophyd_async/tango/testing/_test_config.py +11 -0
- ophyd_async/testing/_assert.py +2 -2
- {ophyd_async-0.13.4.dist-info → ophyd_async-0.13.5.dist-info}/METADATA +2 -36
- {ophyd_async-0.13.4.dist-info → ophyd_async-0.13.5.dist-info}/RECORD +30 -29
- {ophyd_async-0.13.4.dist-info → ophyd_async-0.13.5.dist-info}/WHEEL +0 -0
- {ophyd_async-0.13.4.dist-info → ophyd_async-0.13.5.dist-info}/licenses/LICENSE +0 -0
- {ophyd_async-0.13.4.dist-info → ophyd_async-0.13.5.dist-info}/top_level.txt +0 -0
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
-
from enum import
|
|
6
|
+
from enum import IntEnum
|
|
7
7
|
|
|
8
8
|
import numpy.typing as npt
|
|
9
9
|
from tango import (
|
|
10
|
-
AttrDataFormat,
|
|
11
10
|
AttrWriteType,
|
|
12
|
-
CmdArgType,
|
|
13
11
|
DeviceProxy,
|
|
14
12
|
DevState,
|
|
15
13
|
)
|
|
@@ -25,7 +23,12 @@ from ophyd_async.core import (
|
|
|
25
23
|
SignalX,
|
|
26
24
|
)
|
|
27
25
|
|
|
28
|
-
from ._tango_transport import
|
|
26
|
+
from ._tango_transport import (
|
|
27
|
+
CommandProxyReadCharacter,
|
|
28
|
+
TangoSignalBackend,
|
|
29
|
+
get_command_character,
|
|
30
|
+
get_python_type,
|
|
31
|
+
)
|
|
29
32
|
from ._utils import get_device_trl_and_attr
|
|
30
33
|
|
|
31
34
|
logger = logging.getLogger("ophyd_async")
|
|
@@ -148,22 +151,13 @@ async def infer_python_type(
|
|
|
148
151
|
|
|
149
152
|
if tr_name in dev_proxy.get_command_list():
|
|
150
153
|
config = await dev_proxy.get_command_config(tr_name)
|
|
151
|
-
|
|
154
|
+
py_type = get_python_type(config)
|
|
152
155
|
elif tr_name in dev_proxy.get_attribute_list():
|
|
153
156
|
config = await dev_proxy.get_attribute_config(tr_name)
|
|
154
|
-
|
|
155
|
-
if py_type is Enum:
|
|
156
|
-
enum_dict = {label: i for i, label in enumerate(config.enum_labels)}
|
|
157
|
-
py_type = IntEnum("TangoEnum", enum_dict)
|
|
158
|
-
if config.data_format in [AttrDataFormat.SPECTRUM, AttrDataFormat.IMAGE]:
|
|
159
|
-
isarray = True
|
|
157
|
+
py_type = get_python_type(config)
|
|
160
158
|
else:
|
|
161
159
|
raise RuntimeError(f"Cannot find {tr_name} in {device_trl}")
|
|
162
|
-
|
|
163
|
-
if py_type is CmdArgType.DevState:
|
|
164
|
-
py_type = DevState
|
|
165
|
-
|
|
166
|
-
return npt.NDArray[py_type] if isarray else py_type
|
|
160
|
+
return py_type
|
|
167
161
|
|
|
168
162
|
|
|
169
163
|
async def infer_signal_type(
|
|
@@ -190,11 +184,13 @@ async def infer_signal_type(
|
|
|
190
184
|
|
|
191
185
|
if tr_name in dev_proxy.get_command_list():
|
|
192
186
|
config = await dev_proxy.get_command_config(tr_name)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return
|
|
198
|
-
|
|
187
|
+
command_character = get_command_character(config)
|
|
188
|
+
if command_character == CommandProxyReadCharacter.READ:
|
|
189
|
+
return SignalR
|
|
190
|
+
elif command_character == CommandProxyReadCharacter.WRITE:
|
|
191
|
+
return SignalW
|
|
192
|
+
elif command_character == CommandProxyReadCharacter.READ_WRITE:
|
|
199
193
|
return SignalRW
|
|
194
|
+
elif command_character == CommandProxyReadCharacter.EXECUTE:
|
|
195
|
+
return SignalX
|
|
200
196
|
raise RuntimeError(f"Unable to infer signal character for {trl}")
|