Bridge between Tango Controls and PyAML
tango-pyaml is a Python bridge between the Tango control system and the PyAML abstraction layer for control systems. It provides a set of classes that allow Tango attributes and devices to be accessed and controlled using PyAML concepts.
This library is part of the Python Accelerator Middle Layer (PyAML) ecosystem.
- β Read and write Tango attributes via a unified PyAML interface
- π Support for read-only and read/write attributes
- π Grouped attribute operations using
tango.Group - π₯ Exception mapping from Tango exceptions to PyAML exceptions
- π§Ή Designed to integrate seamlessly with PyAML
ControlSystemcomponents - π§ͺ Mocked devices for unit testing without Tango runtime
pip install tango-pyamlFor development and testing:
pip install tango-pyaml[dev]This is an example of an explicit call to a Tango attribute using PyAML. For more details about implicit declaration and broader configuration options, please refer to the PyAML documentation.
Configuration file attribute.yaml:
attribute: "sys/tg_test/1/float_scalar"
unit: "A"Python code:
from tango.pyaml.attribute import Attribute
from tango.pyaml.tango_attribute import ConfigModel
import yaml
with open("attribute.yaml") as f:
cfg_dict = yaml.safe_load(f)
cfg = ConfigModel(**cfg_dict)
attr = Attribute(cfg)
attr.set(10.0)
value = attr.get()
readback = attr.readback()
print(f"Value: {value}, Readback: {readback.value} [{readback.quality}]")Attributeβ Read/write access to a Tango attributeAttributeReadOnlyβ Read-only attribute wrapperAttributeListβ Manage a group of attributes from multiple devicesTangoControlSystemβ Adapter to configure global Tango control system context
Tests rely on mocked Tango devices and attributes using unittest.mock. To run tests:
pytesttango.pyaml.attributeβ Main attribute interfacetango.pyaml.attribute_read_onlyβ Read-only attribute implementationtango.pyaml.attribute_listβ Attribute groups withtango.Grouptango.pyaml.tango_attributeβ Base class wrapping attribute logicmocked_device_proxy.pyβ In-memory mock for TangoDeviceProxyandAttributeProxy
This project is licensed under the MIT License.
- π§Ί Repository