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', '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', 'MeasurementGroup', 'ControllerLibrary', 'ControllerClass', 'Constraint', 'External', 'MacroServerObject', 'MacroServerElement', 'MacroServer', 'Door', 'MacroLibrary', 'MacroCode', 'MacroClass', 'MacroFunction', 'Macro', 'ParameterType'])

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}, 67113158: {198, 4294}, 134217826: {34, 66}, 268435530: {10, 66}, 536870978: {66}, 1073741826: {2}, 2147483650: {2}, 6442450950: {6, 2147483650}, 15032385542: {6442450950}, 23622320134: {6442450950}, 36507222050: {34, 2147483650}, 70866960386: {2147483650}, 208305913866: {10, 70866960386}, 345744867346: {18, 70866960386}, 1032939634714: {208305913866, 345744867346}, 1099511627777: {1}}

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}, 67113158: {2, 6, 66, 198, 4294, 67113158}, 134217826: {2, 34, 66, 134217826}, 268435530: {2, 10, 66, 268435530}, 536870978: {2, 66, 536870978}, 1073741826: {2, 1073741826}, 2147483650: {2, 2147483650}, 6442450950: {2, 6, 2147483650, 6442450950}, 15032385542: {2, 6, 2147483650, 6442450950, 15032385542}, 23622320134: {2, 6, 2147483650, 6442450950, 23622320134}, 36507222050: {2, 34, 2147483650, 36507222050}, 70866960386: {2, 2147483650, 70866960386}, 208305913866: {2, 10, 2147483650, 70866960386, 208305913866}, 345744867346: {2, 18, 2147483650, 70866960386, 345744867346}, 1032939634714: {2, 10, 18, 2147483650, 70866960386, 208305913866, 345744867346, 1032939634714}, 1099511627777: {1, 1099511627777}}

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