tango.pyaml.attribute_list#

Grouped Tango attribute access.

This module handles a list of Tango attributes through tango.Group objects, one per distinct attribute name, so that a value can be written to or read from many devices in a single call.

Classes

AttributeList(attributes[, name, unit])

Handle a list of Tango attributes using Tango Groups.

AttributeListConfig(*, attributes[, name, unit])

Configuration model for a list of Tango attributes.

class tango.pyaml.attribute_list.AttributeList(attributes, name='', unit='')#

Bases: DeviceAccess, InitializableElement, DynamicValidation

Handle a list of Tango attributes using Tango Groups.

Attributes are grouped by attribute name: one tango.Group is created per distinct attribute name and holds every device exposing it. Groups are created lazily on first access.

Parameters:
  • attributes (list of str) – List of Tango attribute paths.

  • name (str, optional) – Group name.

  • unit (str, optional) – Unit of the attributes.

_attributes#

Tango attribute paths in configured order.

Type:

list of str

_name#

Group name.

Type:

str

_unit#

Unit of the attributes.

Type:

str

_tango_groups#

Tango groups indexed by attribute name, created on initialization.

Type:

dict of str to tango.Group

_attr_dev#

Device names indexed by attribute name.

Type:

dict of str to list of str

initialize()#

Create one Tango group per attribute name.

name()#

Return the group name.

measure_name()#

Return the group name (alias for measurement name).

get_tango_attributes()#

Return the raw Tango attribute paths stored in the configuration.

set(value)#

Write a value asynchronously to all Tango attributes.

set_and_wait(value)#

Write a value synchronously to all Tango attributes.

get()#

Return the last written values of all attributes.

readback()#

Return readback values with metadata for all attributes.

unit()#

Return the unit for the attribute list.

get_range()#

Return the valid ranges of the attributes.

check_device_availability()#

Check whether every device of the groups answers to a ping.

check_device_availability()#

Check whether every device of the groups answers to a ping.

Returns:

boolTrue if all devices are reachable, False if initialization or any ping fails.

Return type:

bool

get()#

Return the last written values of all attributes.

Returns:

numpy.ndarray – Array of last written values ordered as in configuration. Entries whose read failed are None.

Return type:

array

get_range()#

Return the valid ranges of the attributes.

If a _range is configured it is returned as [min, max]. Otherwise the limits are read from the Tango attribute configuration of every device and returned flattened as [min0, max0, min1, max1, ...], in group order.

Returns:

list of float or None – Range limits, where an unbounded limit is None.

Return type:

list[float]

get_tango_attributes()#

Return the raw Tango attribute paths stored in the configuration.

Returns:

list of str – Tango attribute paths in configured order.

Return type:

list[str]

initialize()#

Create one Tango group per attribute name.

Each group is named after the list and populated with the devices exposing that attribute.

measure_name()#

Return the group name (alias for measurement name).

Returns:

str – Group name.

Return type:

str

name()#

Return the group name.

Returns:

str – Group name.

Return type:

str

readback()#

Return readback values with metadata for all attributes.

Returns:

numpy.ndarray – Array of Value objects ordered as in configuration. Entries whose read failed are None.

Return type:

array

set(value)#

Write a value asynchronously to all Tango attributes.

Parameters:

value (float) – Value to write.

set_and_wait(value)#

Write a value synchronously to all Tango attributes.

Parameters:

value (float) – Value to write.

unit()#

Return the unit for the attribute list.

Returns:

str – Unit string.

Return type:

str

class tango.pyaml.attribute_list.AttributeListConfig(*, attributes, name='', unit='')#

Bases: BaseModel

Configuration model for a list of Tango attributes.

attributes#

List of Tango attribute paths.

Type:

list of str

name#

Group name.

Type:

str, optional

unit#

Unit of the attributes.

Type:

str, optional

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].