tango_utils module

Generic utility functions for working with Tango devices.

aiv_utils.tango_utils.member(dev)

Return the member part of the device TRL.

For example, if the TRL is “low-mccs/tile/s8-1-tpm01”, then the member part is “s8-1-tpm01”.

Return type:

str

Returns:

the member part of the device TRL.

aiv_utils.tango_utils.read_all(devs, attr)

Uses GreenMode.Futures to read the same attr on all devs.

Return type:

list

aiv_utils.tango_utils.single_prop(dev, prop_name)

Return the first value of a device property.

Properties are always lists but many properties only expect a single value. This convenience method makes accessing those less verbose.

Return type:

str

aiv_utils.tango_utils.tango_attr_value(dev, attr, default=<object object>)

Like getattr(dev, attr, default), but using item lookup rather than attribute access.

aiv_utils.tango_utils.wait_for(devs, attr, desired_value, timeout=60.0, quiet=False)

Block until attr of each of devs has a certain value or matches a predicate.

Parameters:
  • devs (DeviceProxy | list[DeviceProxy]) – a DeviceProxy or a list of DeviceProxy

  • attr (str) – the name of the attribute to wait for

  • desired_value – an attribute value to wait for, or a custom predicate which may accept either one argument (the value) or two (the value, and the device)

  • timeout (float) – maximum time to wait for each device to meet the condition

  • quiet (bool) – don’t log anything

Return type:

None

Returns:

None