taurus.core.tango

Tango extension for taurus core mode. The Tango extension implements taurus.core objects that connect to Tango objects. The official scheme name is, obviously, ‘tango’.

This extension maps the (Py)Tango objects into Taurus objects as follows:

  • A Tango database is represented as a subclass of taurus.core.TaurusAuthority

  • A Tango device is represented as a subclass of taurus.core.TaurusDevice

  • A Tango device attribute is represented as a subclass taurus.core.TaurusAttribute

You should never create objects from the above classes directly. Instead, you should use taurus.Authority(), taurus.Device(), and taurus.Attribute() helper functions, as in the examples below, or if you require more control, use the taurus.core.taurusmanager.TaurusManager or taurus.core.taurusfactory.TaurusFactory APIs.

Here are some examples:

The Taurus Authority associated with the Tango database running on host “machine01” and port 10000 is named “//machine:10000” (note that Taurus authority names are always prefixed by “//”, to comply with RFC3986). And you can get the corresponding Taurus Authority object as:

>>> import taurus
>>> my_db = taurus.Authority('tango://machine:10000')

If “tango” is configured as the default scheme for Taurus, the ‘tango:’ prefix could be avoided and same database could be accessed as:

>>> my_db = taurus.Authority('//machine:10000')

Now, assume that a TangoTest device is registered in the above database as sys/tg_test/1. In this case, the corresponding Taurus device full name would be tango://machine:10000/sys/tg_test/1 and it could be accessed as:

>>> import taurus
>>> my_device = taurus.Device('tango://machine:10000/sys/tg_test/1')

If “tango” is configured as the default scheme for Taurus, the previous name could be shortened to //machine:10000/sys/tg_test/1 or even to sys/tg_test/1 if the TANGO_HOST environment variable (or tango.rc file) point to machine:10000 as the default tango database. Furthermore, if, on top of that, this device is aliased as tgtest1 in the database, it could be accessed as:

>>> import taurus
>>> my_device = taurus.Device('tgtest1')

Similarly, accessing the ampli attribute from the above Tango device can be done using its full name:

>>> import taurus
>>> my_attr = taurus.Attribute('tango://machine:10000/sys/tg_test/1/ampli')

And of course shorter names can also be used for attributes. Following the examples for the device above, the following names could also have been passed to taurus.Attribute():

  • //machine:10000/sys/tg_test/1/ampli

  • sys/tg_test/1/ampli

  • tgtest1/ampli

Finally, the TangoFactory object can be accessed as:

>>> import taurus
>>> tg_factory = taurus.Factory('tango')

Note

Previous to TEP3, a RFC3986 non-compliant syntax was used for the Tango scheme (e.g., allowing names such as tango://a/b/c/d -note the double slash which should not be there). This syntax is now deprecated and should not be used. Taurus will issue warnings if detected.

Submodules

Classes

class DevState(value)[source]

This is the taurus.core.tango equivalent to PyTango.DevState. It defines the same members and uses the same numerical values internally, allowing equality comparisons with PyTango.DevState (but not identity checks!):

from taurus.core.tango import DevState as D1
from PyTango import DevState as D2

D1.OPEN == D2.OPEN          # --> True
D1.OPEN in (D2.ON, D2.OPEN) # --> True
D1.OPEN == 3                # --> True
D1.OPEN is 3                # --> False
D1.OPEN is D2.OPEN          # --> False

(more info)

class TangoAttribute(name='', parent=None, **kwargs)[source]

(more info)

class TangoAttributeEventListener(attr)[source]

A class that listens for an event with a specific value

Note: Since this class stores for each event value the last timestamp when it occured, it should only be used for events for which the event value domain (possible values) is limited and well known (ex: an enum)

(more info)

class TangoAttrInfo(container, name=None, full_name=None, device=None, info=None)[source]

(more info)

class TangoAttrValue(attr=None, pytango_dev_attr=None, config=None)[source]

A TaurusAttrValue specialization to decode PyTango.DeviceAttribute objects

(more info)

class TangoAuthority(host=None, port=None, parent=None)[source]

(more info)

class TangoConfiguration(**kwargs)[source]

(more info)

TangoDatabase

alias of TangoAuthority

class TangoDatabaseCache(db)[source]

(more info)

class TangoDevClassInfo(container, name=None, full_name=None)[source]

(more info)

class TangoDevice(name='', **kw)[source]

A Device object representing an abstraction of the PyTango.DeviceProxy object in the taurus.core.tango scheme

(more info)

class TangoDevInfo(container, name=None, full_name=None, alias=None, server=None, klass=None, exported=False, host=None)[source]

(more info)

class TangoFactory(*p, **k)[source]

A TaurusFactory singleton class to provide Tango-specific Taurus Element objects (TangoAuthority, TangoDevice, TangoAttribute)

Tango model names are URI based See https://tools.ietf.org/html/rfc3986. For example, a TangoAttribute would be:

tango://foo.org:1234/a/b/c/d#label
\___/   \_____/ \__/ \_____/ \___/
  |        |     |      |      |
  |    hostname port  attr     |
  |   \____________/\______/   |
  |         |           |      |
scheme   authority     path  fragment

For Tango Elements:

  • The ‘scheme’ must be the string “tango” (lowercase mandatory)

  • The ‘authority’ identifies the Tango database (<hostname> and <port> are mandatory if authority is given)

  • The ‘path’ identifies Tango Device and Attributes. For devices it must have the format _/_/_ or alias For attributes it must have the format _/_/_/_ or devalias/_

  • The ‘fragment’ is optional and it refers to a member of the model object, thus not being part of the model name itself

(more info)

class TangoInfo(container, name=None, full_name=None)[source]

(more info)

class TangoServInfo(container, name=None, full_name=None)[source]

(more info)

Variables

EVENT_TO_POLLING_EXCEPTIONS
FROM_TANGO_TO_NUMPY_TYPE
FROM_TANGO_TO_STR_TYPE
TangoObjectType