ophyd_async.tango.core
#
Package Contents#
Classes#
Used by the tango transport. |
|
Tango proxy for commands. |
|
Tango backend to connect signals over tango. |
|
General class for TangoDevices. |
|
General class for TangoDevices. |
|
Abstract base class for generic types. |
|
Defines how a |
Functions#
Ensure decorated method has a proper asyncio executor. |
|
For converting between recieved tango types and python primatives. |
|
For converting tango types to numpy datatype formats. |
|
Create a descriptor from a tango resource locator. |
|
Get the tango resource locator. |
|
Infers the python type from the TRL. |
|
Create a |
|
Create a |
|
Create a |
|
Create a |
API#
- class ophyd_async.tango.core.AttributeProxy(device_proxy: DeviceProxy, name: str)[source]#
Bases:
ophyd_async.tango.core._tango_transport.TangoProxy
Used by the tango transport.
- exception: BaseException | None#
None
- async connect() None [source]#
Perform actions after proxy is connected.
e.g. check if signal can be subscribed.
- async put(value: object | None, wait: bool = True, timeout: float | None = None) AsyncStatus | None [source]#
Put value to TRL.
- class ophyd_async.tango.core.CommandProxy(device_proxy: DeviceProxy, name: str)[source]#
Bases:
ophyd_async.tango.core._tango_transport.TangoProxy
Tango proxy for commands.
- abstractmethod subscribe_callback(callback: Callback | None) None [source]#
Subscribe tango CHANGE event to callback.
- async connect() None [source]#
Perform actions after proxy is connected.
e.g. check if signal can be subscribed.
- ophyd_async.tango.core.ensure_proper_executor(func: Callable[P, Coroutine[Any, Any, R]]) Callable[P, Coroutine[Any, Any, R]] [source]#
Ensure decorated method has a proper asyncio executor.
- class ophyd_async.tango.core.TangoSignalBackend(datatype: type[SignalDatatypeT] | None, read_trl: str = '', write_trl: str = '', device_proxy: DeviceProxy | None = None)[source]#
Bases:
ophyd_async.core.SignalBackend
[ophyd_async.core.SignalDatatypeT
]Tango backend to connect signals over tango.
- source(name: str, read: bool) str [source]#
Return source of signal.
- Parameters:
name – The name of the signal, which can be used or discarded.
read – True if we want the source for reading, False if writing.
- async put(value: SignalDatatypeT | None, wait=True, timeout=None) None [source]#
Put a value to the PV, if wait then wait for completion.
- async get_datakey(source: str) DataKey [source]#
Metadata like source, dtype, shape, precision, units.
- async get_reading() Reading[SignalDatatypeT] [source]#
Return the current value, timestamp and severity.
- async get_value() SignalDatatypeT [source]#
Return the current value.
- async get_setpoint() SignalDatatypeT [source]#
Return the point that a signal was requested to move to.
- set_callback(callback: Callback | None) None [source]#
Observe changes to the current value, timestamp and severity.
- ophyd_async.tango.core.get_python_type(tango_type: CmdArgType) tuple[bool, object, str] [source]#
For converting between recieved tango types and python primatives.
- ophyd_async.tango.core.get_dtype_extended(datatype) object | None [source]#
For converting tango types to numpy datatype formats.
- ophyd_async.tango.core.get_trl_descriptor(datatype: type | None, tango_resource: str, tr_configs: dict[str, AttributeInfoEx | CommandInfo]) DataKey [source]#
Create a descriptor from a tango resource locator.
- async ophyd_async.tango.core.get_tango_trl(full_trl: str, device_proxy: DeviceProxy | TangoProxy | None, timeout: float) TangoProxy [source]#
Get the tango resource locator.
- async ophyd_async.tango.core.infer_python_type(trl: str = '', proxy: DeviceProxy | None = None) object | NDArray | type[DevState] | IntEnum [source]#
Infers the python type from the TRL.
- async ophyd_async.tango.core.infer_signal_type(trl, proxy: DeviceProxy | None = None) type[Signal] | None [source]#
- ophyd_async.tango.core.make_backend(datatype: type[SignalDatatypeT] | None, read_trl: str = '', write_trl: str = '', device_proxy: DeviceProxy | None = None) TangoSignalBackend [source]#
- ophyd_async.tango.core.tango_signal_r(datatype: type[SignalDatatypeT], read_trl: str, device_proxy: DeviceProxy | None = None, timeout: float = DEFAULT_TIMEOUT, name: str = '') SignalR[SignalDatatypeT] [source]#
Create a
SignalR
backed by 1 Tango Attribute/Command.Parameters
datatype: Check that the Attribute/Command is of this type read_trl: The Attribute/Command to read and monitor device_proxy: If given, this DeviceProxy will be used timeout: The timeout for the read operation name: The name of the Signal
- ophyd_async.tango.core.tango_signal_rw(datatype: type[SignalDatatypeT], read_trl: str, write_trl: str = '', device_proxy: DeviceProxy | None = None, timeout: float = DEFAULT_TIMEOUT, name: str = '') SignalRW[SignalDatatypeT] [source]#
Create a
SignalRW
backed by 1 or 2 Tango Attribute/Command.Parameters
datatype: Check that the Attribute/Command is of this type read_trl: The Attribute/Command to read and monitor write_trl: If given, use this Attribute/Command to write to, otherwise use read_trl device_proxy: If given, this DeviceProxy will be used timeout: The timeout for the read and write operations name: The name of the Signal
- ophyd_async.tango.core.tango_signal_w(datatype: type[SignalDatatypeT], write_trl: str, device_proxy: DeviceProxy | None = None, timeout: float = DEFAULT_TIMEOUT, name: str = '') SignalW[SignalDatatypeT] [source]#
Create a
SignalW
backed by 1 Tango Attribute/Command.Parameters
datatype: Check that the Attribute/Command is of this type write_trl: The Attribute/Command to write to device_proxy: If given, this DeviceProxy will be used timeout: The timeout for the write operation name: The name of the Signal
- ophyd_async.tango.core.tango_signal_x(write_trl: str, device_proxy: DeviceProxy | None = None, timeout: float = DEFAULT_TIMEOUT, name: str = '') SignalX [source]#
Create a
SignalX
backed by 1 Tango Attribute/Command.Parameters
write_trl: The Attribute/Command to write its initial value to on execute device_proxy: If given, this DeviceProxy will be used timeout: The timeout for the command operation name: The name of the Signal
- class ophyd_async.tango.core.TangoDevice(trl: str | None = None, device_proxy: DeviceProxy | None = None, support_events: bool = False, name: str = '')[source]#
Bases:
ophyd_async.core.Device
General class for TangoDevices.
Extends Device to provide attributes for Tango devices.
- Parameters:
trl – Tango resource locator, typically of the device server.
device_proxy – Asynchronous or synchronous DeviceProxy object for the device. If not provided, an asynchronous DeviceProxy object will be created using the trl and awaited when the device is connected.
- class ophyd_async.tango.core.TangoReadable(trl: str | None = None, device_proxy: DeviceProxy | None = None, name: str = '')[source]#
Bases:
ophyd_async.tango.core._base_device.TangoDevice
,ophyd_async.core.StandardReadable
General class for TangoDevices.
Extends Device to provide attributes for Tango devices.
- Parameters:
trl – Tango resource locator, typically of the device server.
device_proxy – Asynchronous or synchronous DeviceProxy object for the device. If not provided, an asynchronous DeviceProxy object will be created using the trl and awaited when the device is connected.
- class ophyd_async.tango.core.TangoPolling[source]#
Bases:
typing.Generic
[ophyd_async.tango.core._base_device.T
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- class ophyd_async.tango.core.TangoDeviceConnector(trl: str | None, device_proxy: DeviceProxy | None, support_events: bool)[source]#
Bases:
ophyd_async.core.DeviceConnector
Defines how a
Device
should be connected and type hints processed.- create_children_from_annotations(device: Device)[source]#
Use when children can be created from introspecting the hardware.
Some control systems allow introspection of a device to determine what children it has. To allow this to work nicely with typing we add these hints to the Device like so::
my_signal: SignalRW[int] my_device: MyDevice
This method will be run during
Device.__init__
, and is responsible for turning all of those type hints into real Signal and Device instances.Subsequent runs of this function should do nothing, to allow it to be called early in Devices that need to pass references to their children during
__init__
.
- async connect_mock(device: Device, mock: LazyMock)[source]#
Use during
Device.connect
withmock=True
.This is called when there is no cached connect done in
mock=True
mode. It connects the Device and all its children in mock mode.