sardanadefs

This module contains the most generic sardana constants and enumerations

Constants

EpsilonError = 1e-16

maximum difference between two floats so that they are considered equal

InvalidId = 0

A constant representing an invalid ID

InvalidAxis = 0

A constant representing an invalid axis

TYPE_ELEMENTS = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}

a set containning all “controllable” element types. Constant values belong to ElementType

TYPE_GROUP_ELEMENTS = {13, 14}

a set containing all group element types. Constant values belong to ElementType

TYPE_MOVEABLE_ELEMENTS = {2, 10, 13}

a set containing the type of elements which are moveable. Constant values belong to ElementType

TYPE_PHYSICAL_ELEMENTS = {2, 3, 4, 5, 6, 7, 8, 9}

a set containing the possible types of physical elements. Constant values belong to ElementType

TYPE_ACQUIRABLE_ELEMENTS = {2, 3, 4, 5, 6, 7, 8, 10, 11}

a set containing the possible types of acquirable elements. Constant values belong to ElementType

TYPE_PSEUDO_ELEMENTS = {10, 11}

a set containing the possible types of pseudo elements. Constant values belong to ElementType

SardanaServer = SardanaServer()

the global object containing the SardanaServer information

Enumerations

ServerRunMode = Enumeration('ServerRunMode', ['SynchPure', 'SynchThread', 'SynchProcess', 'AsynchThread', 'AsynchProcess'])

The sardana server run mode:

  • SynchPure : Pure synchronous: Start the server and run the server loop until it stops

  • SynchThread : separate thread synchronous: start a thread running the server loop. Block until the server loop ends

  • SynchProcess : separate process synchronous: start a sub-process running the server loop. Block until the server loop ends

  • AsynchThread : separate thread asynchronous: start a thread running the server loop. Return immediately

  • ASynchProcess : separate process asynchronous: start a sub-process running the server loop. Return immediately

State = Enumeration('State', ['On', 'Off', 'Close', 'Open', 'Insert', 'Extract', 'Moving', 'Standby', 'Fault', 'Init', 'Running', 'Alarm', 'Disable', 'Unknown', 'Invalid'])

sardana element state enumeration

DataType = Enumeration('DataType', ['Integer', 'Double', 'String', 'Boolean', 'Encoded', 'Invalid'])

sardana data types (used by device pool controllers)

DataFormat = Enumeration('DataFormat', ['Scalar', 'OneD', 'TwoD', 'Invalid'])

sardana data format enumeration (used by device pool controllers)

DataAccess = Enumeration('DataAccess', ['ReadOnly', 'ReadWrite', 'Invalid'])

sardana data access (used by device pool controllers)

ElementType = Enumeration('ElementType', ['Pool', 'Controller', 'Motor', 'CTExpChannel', 'ZeroDExpChannel', 'OneDExpChannel', 'TwoDExpChannel', 'ComChannel', 'IORegister', 'TriggerGate', 'PseudoMotor', 'PseudoCounter', 'Constraint', 'MotorGroup', 'MeasurementGroup', 'Instrument', 'Shutter', 'ControllerClass', 'ControllerLibrary', 'RecorderClass', 'RecorderLibrary', 'MacroServer', 'Door', 'MacroClass', 'MacroLibrary', 'MacroFunction', 'External', 'Meta', 'ParameterType', 'Unknown'])

An enumeration describing the all possible element types in sardana

Interface = Enumeration('Interface', ['Meta', 'Object', 'Element', 'Class', 'Function', 'Library', 'PoolObject', 'PoolElement', 'Pool', 'Controller', 'Moveable', 'Acquirable', 'Countable', 'Instrument', 'Motor', 'PseudoMotor', 'IORegister', 'ExpChannel', 'CTExpChannel', 'ZeroDExpChannel', 'OneDExpChannel', 'TwoDExpChannel', 'TriggerGate', 'PseudoCounter', 'ComChannel', 'MotorGroup', 'Shutter', 'MeasurementGroup', 'ControllerLibrary', 'ControllerClass', 'Constraint', 'External', 'MacroServerObject', 'MacroServerElement', 'MacroServer', 'Door', 'MacroLibrary', 'MacroCode', 'MacroClass', 'MacroFunction', 'Macro', 'ParameterType', 'RecorderLibrary', 'RecorderClass'])

An enumeration describing the all possible sardana interfaces

Interfaces = {1: {}, 2: {}, 6: {2}, 10: {2}, 18: {2}, 34: {2}, 66: {2}, 198: {6, 66}, 454: {198}, 710: {198}, 1222: {198}, 2246: {198}, 4294: {198}, 8390: {198}, 19654: {1222, 2246}, 36038: {1222, 2246}, 67782: {2246}, 133318: {2246}, 399558: {4294, 133318}, 657606: {133318}, 1185990: {4294, 133318}, 2234566: {4294, 133318}, 4194502: {198}, 8521926: {133318}, 16777414: {198}, 33554630: {198}, 67109062: {198}, 134222022: {198, 4294}, 268435554: {34, 66}, 536870986: {10, 66}, 1073741890: {66}, 2147483650: {2}, 4294967298: {2}, 12884901894: {6, 4294967298}, 30064771078: {12884901894}, 47244640262: {12884901894}, 73014444066: {34, 4294967298}, 141733920770: {4294967298}, 416611827722: {10, 141733920770}, 691489734674: {18, 141733920770}, 2065879269402: {416611827722, 691489734674}, 2199023255553: {1}, 4398046511138: {34}, 8796093022218: {10}}

a dictionary containing the direct interfaces supported by each type (dict <sardana.sardanadefs.Interface, set < sardana.sardanadefs.Interface> >)

InterfacesExpanded = {1: {1}, 2: {2}, 6: {2, 6}, 10: {2, 10}, 18: {2, 18}, 34: {2, 34}, 66: {2, 66}, 198: {2, 6, 66, 198}, 454: {2, 6, 66, 198, 454}, 710: {2, 6, 66, 198, 710}, 1222: {2, 6, 66, 198, 1222}, 2246: {2, 6, 66, 198, 2246}, 4294: {2, 6, 66, 198, 4294}, 8390: {2, 6, 66, 198, 8390}, 19654: {2, 6, 66, 198, 1222, 2246, 19654}, 36038: {2, 6, 66, 198, 1222, 2246, 36038}, 67782: {2, 6, 66, 198, 2246, 67782}, 133318: {2, 6, 66, 198, 2246, 133318}, 399558: {2, 6, 66, 198, 2246, 4294, 133318, 399558}, 657606: {2, 6, 66, 198, 2246, 133318, 657606}, 1185990: {2, 6, 66, 198, 2246, 4294, 133318, 1185990}, 2234566: {2, 6, 66, 198, 2246, 4294, 133318, 2234566}, 4194502: {2, 6, 66, 198, 4194502}, 8521926: {2, 6, 66, 198, 2246, 133318, 8521926}, 16777414: {2, 6, 66, 198, 16777414}, 33554630: {2, 6, 66, 198, 33554630}, 67109062: {2, 6, 66, 198, 67109062}, 134222022: {2, 6, 66, 198, 4294, 134222022}, 268435554: {2, 34, 66, 268435554}, 536870986: {2, 10, 66, 536870986}, 1073741890: {2, 66, 1073741890}, 2147483650: {2, 2147483650}, 4294967298: {2, 4294967298}, 12884901894: {2, 6, 4294967298, 12884901894}, 30064771078: {2, 6, 4294967298, 12884901894, 30064771078}, 47244640262: {2, 6, 4294967298, 12884901894, 47244640262}, 73014444066: {2, 34, 4294967298, 73014444066}, 141733920770: {2, 4294967298, 141733920770}, 416611827722: {2, 10, 4294967298, 141733920770, 416611827722}, 691489734674: {2, 18, 4294967298, 141733920770, 691489734674}, 2065879269402: {2, 10, 18, 4294967298, 141733920770, 416611827722, 691489734674, 2065879269402}, 2199023255553: {1, 2199023255553}, 4398046511138: {2, 34, 4398046511138}, 8796093022218: {2, 10, 8796093022218}}

a dictionary containing the all interfaces supported by each type. (dict <sardana.sardanadefs.Interface, set < sardana.sardanadefs.Interface> >)

Functions

from_dtype_str(dtype)[source]

Transforms the given dtype parameter (string/DataType or None) into a tuple of two elements (str, DataFormat) where the first element is a string with a simplified data type.

  • If None is given, it returns (‘float’, DataFormat.Scalar)

  • If DataType is given, it returns (DataType, DataFormat.Scalar)

Parameters:

dtype (Union[str, None, DataType]) – the data type to be transformed

Return type:

Tuple[str, DataFormat]

Returns:

a tuple <str, DataFormat> for the given dtype

from_access_str(access)[source]

Transforms the given access parameter (string or DataAccess) into a simplified data access string.

Return type:

str

Returns:

a simple string for the given access

to_dtype_dformat(data)[source]

Transforms the given data parameter (string/ or sequence of string or sequence of sequence of string/DataType) into a tuple of two elements (DataType, DataFormat).

Parameters:

data (Union[str, Sequence[str], Sequence[Sequence[str]]]) – the data information to be transformed

Return type:

Tuple[DataType, DataFormat]

Returns:

a tuple <DataType, DataFormat> for the given data

to_daccess(daccess)[source]

Transforms the given access parameter (string or None) into a DataAccess. If None is given returns DataAccess.ReadWrite

Parameters:

dtype – the access to be transformed

Return type:

DataAccess

Returns:

a DataAccess for the given access