Attribute classes

Attr

class tango.Attr(*args, **kwargs)

This class represents a Tango writable attribute.

check_type(self)

This method checks data type and throws an exception in case of unsupported data type

Raises

DevFailed: If the data type is unsupported.

get_assoc(self) str

Get the associated name.

Returns

the associated name

Return type

bool

get_cl_name(self) str

Returns the class name.

Returns

the class name

Return type

str

New in PyTango 7.2.0

get_class_properties(self) Sequence[AttrProperty]

Get the class level attribute properties.

Returns

the class attribute properties

Return type

Sequence[AttrProperty]

get_disp_level(self) DispLevel

Get the attribute display level.

Returns

the attribute display level

Return type

DispLevel

get_format(self) AttrDataFormat

Get the attribute format.

Returns

the attribute format

Return type

AttrDataFormat

get_memorized(self) bool

Determine if the attribute is memorized or not.

Returns

True if the attribute is memorized

Return type

bool

get_memorized_init(self) bool

Determine if the attribute is written at startup from the memorized value if it is memorized.

Returns

True if initialized with memorized value or not

Return type

bool

get_name(self) str

Get the attribute name.

Returns

the attribute name

Return type

str

get_polling_period(self) int

Get the polling period (mS).

Returns

the polling period (mS)

Return type

int

get_type(self) int

Get the attribute data type.

Returns

the attribute data type

Return type

int

get_user_default_properties(self) Sequence[AttrProperty]

Get the user default attribute properties.

Returns

the user default attribute properties

Return type

Sequence[AttrProperty]

get_writable(self) AttrWriteType

Get the attribute write type.

Returns

the attribute write type

Return type

AttrWriteType

is_allowed(self, device, request_type) bool

Returns whether the request_type is allowed for the specified device

Parameters
  • device (tango.server.Device) – instance of Device

  • request_type (AttReqType) – AttReqType.READ_REQ for read request or AttReqType.WRITE_REQ for write request

Returns

True if request_type is allowed for the specified device

Return type

bool

is_archive_event(self) bool

Check if the archive event is fired manually for this attribute.

Returns

true if a manual fire archive event is implemented.

Return type

bool

is_assoc(self) bool

Determine if it is assoc.

Returns

if it is assoc

Return type

bool

is_change_event(self) bool

Check if the change event is fired manually for this attribute.

Returns

true if a manual fire change event is implemented.

Return type

bool

is_check_archive_criteria(self) bool

Check if the archive event criteria should be checked when firing the event manually.

Returns

true if a archive event criteria will be checked.

Return type

bool

is_check_change_criteria(self) bool

Check if the change event criteria should be checked when firing the event manually.

Returns

true if a change event criteria will be checked.

Return type

bool

is_data_ready_event(self) bool

Check if the data ready event is fired for this attribute.

Returns

true if firing data ready event is implemented.

Return type

bool

New in PyTango 7.2.0

set_archive_event(self)

Set a flag to indicate that the server fires archive events manually without the polling to be started for the attribute.

If the detect parameter is set to true, the criteria specified for the archive event are verified and the event is only pushed if they are fullfilled.

If detect is set to false the event is fired without checking!

Parameters
  • implemented (bool) – True when the server fires change events manually.

  • detect (bool) – Triggers the verification of the archive event properties when set to true.

set_change_event(self, implemented, detect)

Set a flag to indicate that the server fires change events manually without the polling to be started for the attribute.

If the detect parameter is set to true, the criteria specified for the change event are verified and the event is only pushed if they are fullfilled.

If detect is set to false the event is fired without checking!

Parameters
  • implemented (bool) – True when the server fires change events manually.

  • detect (bool) – Triggers the verification of the change event properties when set to true.

set_cl_name(self, cl)

Sets the class name.

Parameters

cl (str) – new class name

New in PyTango 7.2.0

set_class_properties(self, props)

Set the class level attribute properties.

Parameters

props (StdAttrPropertyVector) – new class level attribute properties

set_data_ready_event(self, implemented)

Set a flag to indicate that the server fires data ready events.

Parameters

implemented (bool) – True when the server fires data ready events

New in PyTango 7.2.0

set_default_properties(self)

Set default attribute properties.

Parameters

attr_prop (UserDefaultAttrProp) – the user default property class

set_disp_level(self, disp_lelel)

Set the attribute display level.

Parameters

disp_level (DispLevel) – the new display level

set_memorized(self)

Set the attribute as memorized in database (only for scalar and writable attribute).

With no argument the setpoint will be written to the attribute during initialisation!

set_memorized_init(self, write_on_init)

Set the initialisation flag for memorized attributes.

  • true = the setpoint value will be written to the attribute on initialisation

  • false = only the attribute setpoint is initialised.

No action is taken on the attribute

Parameters

write_on_init (bool) – if true the setpoint value will be written to the attribute on initialisation

set_polling_period(self, period)

Set the attribute polling update period.

Parameters

period (int) – the attribute polling period (in mS)

Attribute

class tango.Attribute(*args, **kwargs)

This class represents a Tango attribute.

check_alarm(self) bool

Check if the attribute read value is below/above the alarm level.

Returns

true if the attribute is in alarm condition.

Return type

bool

Raises

DevFailed – If no alarm level is defined.

get_assoc_ind(self) int

Get index of the associated writable attribute.

Returns

the index in the main attribute vector of the associated writable attribute

Return type

int

get_assoc_name(self) str

Get name of the associated writable attribute.

Returns

the associated writable attribute name

Return type

str

get_attr_serial_model(self) AttrSerialModel

Get attribute serialization model.

Returns

The attribute serialization model

Return type

AttrSerialModel

New in PyTango 7.1.0

get_data_format(self) AttrDataFormat

Get attribute data format.

Returns

the attribute data format

Return type

AttrDataFormat

get_data_size(self)

Get attribute data size.

Returns

the attribute data size

Return type

int

get_data_type(self) int

Get attribute data type.

Returns

the attribute data type

Return type

int

get_date(self) TimeVal

Get a COPY of the attribute date.

Returns

the attribute date

Return type

TimeVal

get_label(self) str

Get attribute label property.

Returns

the attribute label

Return type

str

get_max_dim_x(self) int

Get attribute maximum data size in x dimension.

Returns

the attribute maximum data size in x dimension. Set to 1 for scalar attribute

Return type

int

get_max_dim_y(self) int

Get attribute maximum data size in y dimension.

Returns

the attribute maximum data size in y dimension. Set to 0 for scalar attribute

Return type

int

get_name(self) str

Get attribute name.

Returns

The attribute name

Return type

str

get_polling_period(self) int

Get attribute polling period.

Returns

The attribute polling period in mS. Set to 0 when the attribute is not polled

Return type

int

get_properties(self, attr_cfg=None) AttributeConfig

Get attribute properties.

Parameters

conf – the config object to be filled with the attribute configuration. Default is None meaning the method will create internally a new AttributeConfig_5 and return it. Can be AttributeConfig, AttributeConfig_2, AttributeConfig_3, AttributeConfig_5 or MultiAttrProp

Returns

the config object filled with attribute configuration information

Return type

AttributeConfig

New in PyTango 7.1.4

get_quality(self) AttrQuality

Get a COPY of the attribute data quality.

Returns

the attribute data quality

Return type

AttrQuality

get_writable(self) AttrWriteType

Get the attribute writable type (RO/WO/RW).

Returns

The attribute write type.

Return type

AttrWriteType

get_x(self) int

Get attribute data size in x dimension.

Returns

the attribute data size in x dimension. Set to 1 for scalar attribute

Return type

int

get_y(self) int

Get attribute data size in y dimension.

Returns

the attribute data size in y dimension. Set to 0 for scalar attribute

Return type

int

is_archive_event(self) bool

Check if the archive event is fired manually (without polling) for this attribute.

Returns

True if a manual fire archive event is implemented.

Return type

bool

New in PyTango 7.1.0

is_change_event(self) bool

Check if the change event is fired manually (without polling) for this attribute.

Returns

True if a manual fire change event is implemented.

Return type

bool

New in PyTango 7.1.0

is_check_archive_criteria(self) bool

Check if the archive event criteria should be checked when firing the event manually.

Returns

True if a archive event criteria will be checked.

Return type

bool

New in PyTango 7.1.0

is_check_change_criteria(self) bool

Check if the change event criteria should be checked when firing the event manually.

Returns

True if a change event criteria will be checked.

Return type

bool

New in PyTango 7.1.0

is_data_ready_event(self) bool

Check if the data ready event is fired manually (without polling) for this attribute.

Returns

True if a manual fire data ready event is implemented.

Return type

bool

New in PyTango 7.2.0

is_max_alarm(self) bool

Check if the attribute is in maximum alarm condition.

Returns

true if the attribute is in alarm condition (read value above the max. alarm).

Return type

bool

is_max_warning(self) bool

Check if the attribute is in maximum warning condition.

Returns

true if the attribute is in warning condition (read value above the max. warning).

Return type

bool

is_min_alarm(self) bool

Check if the attribute is in minimum alarm condition.

Returns

true if the attribute is in alarm condition (read value below the min. alarm).

Return type

bool

is_min_warning(self) bool

Check if the attribute is in minimum warning condition.

Returns

true if the attribute is in warning condition (read value below the min. warning).

Return type

bool

is_polled(self) bool

Check if the attribute is polled.

Returns

true if the attribute is polled.

Return type

bool

is_rds_alarm(self) bool

Check if the attribute is in RDS alarm condition.

Returns

true if the attribute is in RDS condition (Read Different than Set).

Return type

bool

is_write_associated(self) bool

Check if the attribute has an associated writable attribute.

Returns

True if there is an associated writable attribute

Return type

bool

remove_configuration(self)

Remove the attribute configuration from the database.

This method can be used to clean-up all the configuration of an attribute to come back to its default values or the remove all configuration of a dynamic attribute before deleting it.

The method removes all configured attribute properties and removes the attribute from the list of polled attributes.

New in PyTango 7.1.0

set_archive_event(self, implemented, detect=True)

Set a flag to indicate that the server fires archive events manually, without the polling to be started for the attribute.

If the detect parameter is set to true, the criteria specified for the archive event are verified and the event is only pushed if they are fullfilled.

Parameters
  • implemented (bool) – True when the server fires archive events manually.

  • detect (bool) – (optional, default is True) Triggers the verification of the archive event properties when set to true.

New in PyTango 7.1.0

set_assoc_ind(self, index)

Set index of the associated writable attribute.

Parameters

index (int) – The new index in the main attribute vector of the associated writable attribute

set_attr_serial_model(self, ser_model) void

Set attribute serialization model.

This method allows the user to choose the attribute serialization model.

Parameters

ser_model (AttrSerialModel) – The new serialisation model. The serialization model must be one of ATTR_BY_KERNEL, ATTR_BY_USER or ATTR_NO_SYNC

New in PyTango 7.1.0

set_change_event(self, implemented, detect=True)

Set a flag to indicate that the server fires change events manually, without the polling to be started for the attribute.

If the detect parameter is set to true, the criteria specified for the change event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!

Parameters
  • implemented (bool) – True when the server fires change events manually.

  • detect (bool) – (optional, default is True) Triggers the verification of the change event properties when set to true.

New in PyTango 7.1.0

set_data_ready_event(self, implemented)

Set a flag to indicate that the server fires data ready events.

Parameters

implemented (bool) – True when the server fires data ready events manually.

New in PyTango 7.2.0

set_date(self, new_date)

Set attribute date.

Parameters

new_date (TimeVal) – the attribute date

set_properties(self, attr_cfg, dev)

Set attribute properties.

This method sets the attribute properties value with the content of the fileds in the AttributeConfig/ AttributeConfig_3 object

Parameters
  • conf (AttributeConfig or AttributeConfig_3) – the config object.

  • dev (DeviceImpl) – the device (not used, maintained for backward compatibility)

New in PyTango 7.1.4

set_quality(self, quality, send_event=False)

Set attribute data quality.

Parameters
  • quality (AttrQuality) – the new attribute data quality

  • send_event (bool) – true if a change event should be sent. Default is false.

set_value()

set_value(self, data, dim_x = 1, dim_y = 0) <= DEPRECATED

set_value(self, data)
set_value(self, str_data, data)

Set internal attribute value.

This method stores the attribute read value inside the object. This method also stores the date when it is called and initializes the attribute quality factor.

param data

the data to be set. Data must be compatible with the attribute type and format. In the DEPRECATED form for SPECTRUM and IMAGE attributes, data can be any type of FLAT sequence of elements compatible with the attribute type. In the new form (without dim_x or dim_y) data should be any sequence for SPECTRUM and a SEQUENCE of equal-length SEQUENCES for IMAGE attributes. The recommended sequence is a C continuous and aligned numpy array, as it can be optimized.

param str_data

special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.

type str_data

str

param dim_x

[DEPRECATED] the attribute x length. Default value is 1

type dim_x

int

param dim_y

[DEPRECATED] the attribute y length. Default value is 0

type dim_y

int

set_value_date_quality()

set_value_date_quality(self, data, time_stamp, quality, dim_x = 1, dim_y = 0) <= DEPRECATED

set_value_date_quality(self, data, time_stamp, quality)
set_value_date_quality(self, str_data, data, time_stamp, quality)

Set internal attribute value, date and quality factor.

This method stores the attribute read value, the date and the attribute quality factor inside the object.

param data

the data to be set. Data must be compatible with the attribute type and format. In the DEPRECATED form for SPECTRUM and IMAGE attributes, data can be any type of FLAT sequence of elements compatible with the attribute type. In the new form (without dim_x or dim_y) data should be any sequence for SPECTRUM and a SEQUENCE of equal-length SEQUENCES for IMAGE attributes. The recommended sequence is a C continuous and aligned numpy array, as it can be optimized.

param str_data

special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.

type str_data

str

param dim_x

[DEPRECATED] the attribute x length. Default value is 1

type dim_x

int

param dim_y

[DEPRECATED] the attribute y length. Default value is 0

type dim_y

int

param time_stamp

the time stamp

type time_stamp

double

param quality

the attribute quality factor

type quality

AttrQuality

WAttribute

class tango.WAttribute(*args, **kwargs)

This class represents a Tango writable attribute.

get_max_value(self) obj

Get attribute maximum value or throws an exception if the attribute does not have a maximum value.

Returns

an object with the python maximum value

Return type

obj

get_min_value(self) obj

Get attribute minimum value or throws an exception if the attribute does not have a minimum value.

Returns

an object with the python minimum value

Return type

obj

get_write_value()

get_write_value(self, lst) <= DEPRECATED

get_write_value(self, extract_as=ExtractAs.Numpy) obj

Retrieve the new value for writable attribute.

param extract_as

type extract_as

ExtractAs

param lst

[out] a list object that will be filled with the attribute write value (DEPRECATED)

type lst

list

returns

the attribute write value.

rtype

obj

get_write_value_length(self) int

Retrieve the new value length (data number) for writable attribute.

Returns

the new value data length

Return type

int

is_max_value(self) bool

Check if the attribute has a maximum value.

Returns

true if the attribute has a maximum value defined

Return type

bool

is_min_value(self) bool

Check if the attribute has a minimum value.

Returns

true if the attribute has a minimum value defined

Return type

bool

set_max_value(self, data)

Set attribute maximum value.

Parameters

data – the attribute maximum value. python data type must be compatible with the attribute data format and type.

set_min_value(self, data)

Set attribute minimum value.

Parameters

data – the attribute minimum value. python data type must be compatible with the attribute data format and type.

MultiAttribute

class tango.MultiAttribute(*args, **kwargs)

There is one instance of this class for each device. This class is mainly an aggregate of Attribute or WAttribute objects. It eases management of multiple attributes

check_alarm(self) bool
check_alarm(self, attr_name) bool
check_alarm(self, ind) bool

Checks an alarm.

  • The 1st version of the method checks alarm on all attribute(s) with an alarm defined.

  • The 2nd version of the method checks alarm for one attribute with a given name.

  • The 3rd version of the method checks alarm for one attribute from its index in the main attributes vector.

Parameters
  • attr_name (str) – attribute name

  • ind (int) – the attribute index

Returns

True if at least one attribute is in alarm condition

Return type

bool

Raises

DevFailed – If at least one attribute does not have any alarm level defined

New in PyTango 7.0.0

get_attr_by_ind(self, ind) Attribute

Get Attribute object from its index.

This method returns an Attribute object from the index in the main attribute vector.

Parameters

ind (int) – the attribute index

Returns

the attribute object

Return type

Attribute

get_attr_by_name(self, attr_name) Attribute

Get Attribute object from its name.

This method returns an Attribute object with a name passed as parameter. The equality on attribute name is case independant.

Parameters

attr_name (str) – attribute name

Returns

the attribute object

Return type

Attribute

Raises

DevFailed – If the attribute is not defined.

get_attr_ind_by_name(self, attr_name) int

Get Attribute index into the main attribute vector from its name.

This method returns the index in the Attribute vector (stored in the MultiAttribute object) of an attribute with a given name. The name equality is case independant.

Parameters

attr_name (str) – attribute name

Returns

the attribute index

Return type

int

Raises

DevFailed – If the attribute is not found in the vector.

New in PyTango 7.0.0

get_attr_nb(self) int

Get attribute number.

Returns

the number of attributes

Return type

int

New in PyTango 7.0.0

get_attribute_list(self) Sequence[Attribute]

Get the list of attribute objects.

Returns

list of attribute objects

Return type

Sequence[Attribute]

New in PyTango 7.2.1

get_w_attr_by_ind(self, ind) WAttribute

Get a writable attribute object from its index.

This method returns an WAttribute object from the index in the main attribute vector.

Parameters

ind (int) – the attribute index

Returns

the attribute object

Return type

WAttribute

get_w_attr_by_name(self, attr_name) WAttribute

Get a writable attribute object from its name.

This method returns an WAttribute object with a name passed as parameter. The equality on attribute name is case independant.

Parameters

attr_name (str) – attribute name

Returns

the attribute object

Return type

WAttribute

Raises

DevFailed – If the attribute is not defined.

read_alarm(self, status)

Add alarm message to device status.

This method add alarm mesage to the string passed as parameter. A message is added for each attribute which is in alarm condition

Parameters

status (str) – a string (should be the device status)

New in PyTango 7.0.0

UserDefaultAttrProp

class tango.UserDefaultAttrProp(*args, **kwargs)

User class to set attribute default properties.

This class is used to set attribute default properties. Three levels of attributes properties setting are implemented within Tango. The highest property setting level is the database. Then the user default (set using this UserDefaultAttrProp class) and finally a Tango library default value.

set_abs_change()

set_abs_change(self, def_abs_change) <= DEPRECATED

Set default change event abs_change property.

param def_abs_change

the user default change event abs_change property

type def_abs_change

str

Deprecated since PyTango 8.0. Please use set_event_abs_change instead.

set_archive_abs_change()

set_archive_abs_change(self, def_archive_abs_change) <= DEPRECATED

Set default archive event abs_change property.

param def_archive_abs_change

the user default archive event abs_change property

type def_archive_abs_change

str

Deprecated since PyTango 8.0. Please use set_archive_event_abs_change instead.

set_archive_event_abs_change(self, def_archive_abs_change)

Set default archive event abs_change property.

Parameters

def_archive_abs_change (str) – the user default archive event abs_change property

New in PyTango 8.0

set_archive_event_period(self, def_archive_period)

Set default archive event period property.

Parameters

def_archive_period (str) – t

New in PyTango 8.0

set_archive_event_rel_change(self, def_archive_rel_change)

Set default archive event rel_change property.

Parameters

def_archive_rel_change (str) – the user default archive event rel_change property

New in PyTango 8.0

set_archive_period()

set_archive_period(self, def_archive_period) <= DEPRECATED

Set default archive event period property.

param def_archive_period

t

type def_archive_period

str

Deprecated since PyTango 8.0. Please use set_archive_event_period instead.

set_archive_rel_change()

set_archive_rel_change(self, def_archive_rel_change) <= DEPRECATED

Set default archive event rel_change property.

param def_archive_rel_change

the user default archive event rel_change property

type def_archive_rel_change

str

Deprecated since PyTango 8.0. Please use set_archive_event_rel_change instead.

set_delta_t(self, def_delta_t)

Set default RDS alarm delta_t property.

Parameters

def_delta_t (str) – the user default RDS alarm delta_t property

set_delta_val(self, def_delta_val)

Set default RDS alarm delta_val property.

Parameters

def_delta_val (str) – the user default RDS alarm delta_val property

set_description(self, def_description)

Set default description property.

Parameters

def_description (str) – the user default description property

set_display_unit(self, def_display_unit)

Set default display unit property.

Parameters

def_display_unit (str) – the user default display unit property

set_enum_labels(self, enum_labels)

Set default enumeration labels.

Parameters

enum_labels (Sequence[str]) – list of enumeration labels

New in PyTango 9.2.0

set_event_abs_change(self, def_abs_change)

Set default change event abs_change property.

Parameters

def_abs_change (str) – the user default change event abs_change property

New in PyTango 8.0

set_event_period(self, def_period)

Set default periodic event period property.

Parameters

def_period (str) – the user default periodic event period property

New in PyTango 8.0

set_event_rel_change(self, def_rel_change)

Set default change event rel_change property.

Parameters

def_rel_change (str) – the user default change event rel_change property

New in PyTango 8.0

set_format(self, def_format)

Set default format property.

Parameters

def_format (str) – the user default format property

set_label(self, def_label)

Set default label property.

Parameters

def_label (str) – the user default label property

set_max_alarm(self, def_max_alarm)

Set default max_alarm property.

Parameters

def_max_alarm (str) – the user default max_alarm property

set_max_value(self, def_max_value)

Set default max_value property.

Parameters

def_max_value (str) – the user default max_value property

set_max_warning(self, def_max_warning)

Set default max_warning property.

Parameters

def_max_warning (str) – the user default max_warning property

set_min_alarm(self, def_min_alarm)

Set default min_alarm property.

Parameters

def_min_alarm (str) – the user default min_alarm property

set_min_value(self, def_min_value)

Set default min_value property.

Parameters

def_min_value (str) – the user default min_value property

set_min_warning(self, def_min_warning)

Set default min_warning property.

Parameters

def_min_warning (str) – the user default min_warning property

set_period()

set_period(self, def_period) <= DEPRECATED

Set default periodic event period property.

param def_period

the user default periodic event period property

type def_period

str

Deprecated since PyTango 8.0. Please use set_event_period instead.

set_rel_change()

set_rel_change(self, def_rel_change) <= DEPRECATED

Set default change event rel_change property.

param def_rel_change

the user default change event rel_change property

type def_rel_change

str

Deprecated since PyTango 8.0. Please use set_event_rel_change instead.

set_standard_unit(self, def_standard_unit)

Set default standard unit property.

Parameters

def_standard_unit (str) – the user default standard unit property

set_unit(self, def_unit)

Set default unit property.

Parameters

def_unit (str) – te user default unit property