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> >)

INTERFACES = {'Acquirable': ({'PoolElement'}, 'An acquirable element'), 'CTExpChannel': ({'ExpChannel', 'Countable'}, 'A counter/timer experimental channel'), 'Class': ({'Object'}, 'A generic sardana class'), 'ComChannel': ({'PoolElement'}, 'A communication channel'), 'Constraint': ({'PoolObject'}, 'A constraint'), 'Controller': ({'PoolElement'}, 'A controller'), 'ControllerClass': ({'PoolObject', 'Class'}, 'A controller class'), 'ControllerLibrary': ({'PoolObject', 'Library'}, 'A controller library'), 'Countable': ({'PoolElement'}, 'A countable element'), 'Door': ({'MacroServerElement'}, 'A macro server door'), 'Element': ({'Object'}, 'A generic sardana element'), 'ExpChannel': ({'Acquirable'}, 'A generic experimental channel'), 'External': ({'Object'}, 'An external object'), 'Function': ({'Object'}, 'A generic sardana function'), 'IORegister': ({'Acquirable'}, 'An IO register'), 'Instrument': ({'PoolElement'}, 'An instrument'), 'Library': ({'Object'}, 'A generic sardana library'), 'Macro': ({'MacroClass', 'MacroFunction'}, 'A macro server macro'), 'MacroClass': ({'MacroCode', 'Class'}, 'A macro server macro class'), 'MacroCode': ({'MacroServerObject'}, 'A macro server macro code'), 'MacroFunction': ({'MacroCode', 'Function'}, 'A macro server macro function'), 'MacroLibrary': ({'MacroServerObject', 'Library'}, 'A macro server library'), 'MacroServer': ({'MacroServerElement'}, 'A MacroServer'), 'MacroServerElement': ({'MacroServerObject', 'Element'}, 'A generic macro server element'), 'MacroServerObject': ({'Object'}, 'A generic macro server object'), 'MeasurementGroup': ({'PoolElement', 'Countable'}, 'A measurement group'), 'Meta': (set(), 'A generic sardana meta object'), 'Motor': ({'Acquirable', 'Moveable'}, 'a motor'), 'MotorGroup': ({'PoolElement'}, 'A motor group'), 'Moveable': ({'PoolElement'}, 'A moveable element'), 'Object': (set(), 'A generic sardana object'), 'OneDExpChannel': ({'ExpChannel', 'Countable'}, 'A 1D experimental channel'), 'ParameterType': ({'Meta'}, 'A generic macro server parameter type'), 'Pool': ({'PoolElement'}, 'A Pool'), 'PoolElement': ({'Element', 'PoolObject'}, 'A Pool element'), 'PoolObject': ({'Object'}, 'A Pool object'), 'PseudoCounter': ({'ExpChannel'}, 'A pseudo counter'), 'PseudoMotor': ({'Acquirable', 'Moveable'}, 'A pseudo motor'), 'TriggerGate': ({'PoolElement'}, 'A trigger/gate'), 'TwoDExpChannel': ({'ExpChannel', 'Countable'}, 'A 2D experimental channel'), 'ZeroDExpChannel': ({'ExpChannel'}, 'A 0D experimental channel')}

a dictionary containing the direct interfaces supported by each type (dict<str, tuple<set<str, str>>>)

INTERFACES_EXPANDED = {'Acquirable': ({'PoolElement', 'Element', 'Acquirable', 'Object', 'PoolObject'}, 'An acquirable element'), 'CTExpChannel': ({'PoolElement', 'CTExpChannel', 'Element', 'Object', 'ExpChannel', 'Countable', 'PoolObject', 'Acquirable'}, 'A counter/timer experimental channel'), 'Class': ({'Object', 'Class'}, 'A generic sardana class'), 'ComChannel': ({'PoolElement', 'ComChannel', 'Element', 'Object', 'PoolObject'}, 'A communication channel'), 'Constraint': ({'PoolObject', 'Object', 'Constraint'}, 'A constraint'), 'Controller': ({'PoolElement', 'Element', 'Object', 'PoolObject', 'Controller'}, 'A controller'), 'ControllerClass': ({'Class', 'ControllerClass', 'PoolObject', 'Object'}, 'A controller class'), 'ControllerLibrary': ({'ControllerLibrary', 'Library', 'PoolObject', 'Object'}, 'A controller library'), 'Countable': ({'PoolElement', 'Countable', 'Element', 'Object', 'PoolObject'}, 'A countable element'), 'Door': ({'MacroServerElement', 'MacroServerObject', 'Element', 'Door', 'Object'}, 'A macro server door'), 'Element': ({'Element', 'Object'}, 'A generic sardana element'), 'ExpChannel': ({'PoolElement', 'ExpChannel', 'Element', 'Acquirable', 'Object', 'PoolObject'}, 'A generic experimental channel'), 'External': ({'External', 'Object'}, 'An external object'), 'Function': ({'Object', 'Function'}, 'A generic sardana function'), 'IORegister': ({'PoolElement', 'IORegister', 'Element', 'Acquirable', 'Object', 'PoolObject'}, 'An IO register'), 'Instrument': ({'PoolElement', 'Instrument', 'Element', 'Object', 'PoolObject'}, 'An instrument'), 'Library': ({'Library', 'Object'}, 'A generic sardana library'), 'Macro': ({'Function', 'Macro', 'Object', 'MacroCode', 'Class', 'MacroServerObject', 'MacroClass', 'MacroFunction'}, 'A macro server macro'), 'MacroClass': ({'MacroCode', 'Class', 'MacroServerObject', 'Object', 'MacroClass'}, 'A macro server macro class'), 'MacroCode': ({'MacroServerObject', 'Object', 'MacroCode'}, 'A macro server macro code'), 'MacroFunction': ({'MacroCode', 'Function', 'MacroServerObject', 'Object', 'MacroFunction'}, 'A macro server macro function'), 'MacroLibrary': ({'Library', 'MacroLibrary', 'MacroServerObject', 'Object'}, 'A macro server library'), 'MacroServer': ({'MacroServerElement', 'MacroServerObject', 'Element', 'Object', 'MacroServer'}, 'A MacroServer'), 'MacroServerElement': ({'MacroServerElement', 'MacroServerObject', 'Element', 'Object'}, 'A generic macro server element'), 'MacroServerObject': ({'MacroServerObject', 'Object'}, 'A generic macro server object'), 'MeasurementGroup': ({'PoolElement', 'Element', 'Object', 'Countable', 'PoolObject', 'MeasurementGroup'}, 'A measurement group'), 'Meta': ({'Meta'}, 'A generic sardana meta object'), 'Motor': ({'PoolElement', 'Motor', 'Element', 'Object', 'Moveable', 'PoolObject', 'Acquirable'}, 'a motor'), 'MotorGroup': ({'PoolElement', 'Element', 'Object', 'PoolObject', 'MotorGroup'}, 'A motor group'), 'Moveable': ({'PoolElement', 'Element', 'Object', 'PoolObject', 'Moveable'}, 'A moveable element'), 'Object': ({'Object'}, 'A generic sardana object'), 'OneDExpChannel': ({'PoolElement', 'OneDExpChannel', 'Element', 'Object', 'ExpChannel', 'Countable', 'PoolObject', 'Acquirable'}, 'A 1D experimental channel'), 'ParameterType': ({'Meta', 'ParameterType'}, 'A generic macro server parameter type'), 'Pool': ({'PoolElement', 'Pool', 'Element', 'Object', 'PoolObject'}, 'A Pool'), 'PoolElement': ({'PoolElement', 'Element', 'Object', 'PoolObject'}, 'A Pool element'), 'PoolObject': ({'PoolObject', 'Object'}, 'A Pool object'), 'PseudoCounter': ({'PoolElement', 'ExpChannel', 'PseudoCounter', 'Element', 'Acquirable', 'Object', 'PoolObject'}, 'A pseudo counter'), 'PseudoMotor': ({'PoolElement', 'PseudoMotor', 'Element', 'Object', 'Moveable', 'PoolObject', 'Acquirable'}, 'A pseudo motor'), 'TriggerGate': ({'PoolElement', 'Element', 'TriggerGate', 'Object', 'PoolObject'}, 'A trigger/gate'), 'TwoDExpChannel': ({'PoolElement', 'Element', 'Object', 'ExpChannel', 'Countable', 'PoolObject', 'Acquirable', 'TwoDExpChannel'}, 'A 2D experimental channel'), 'ZeroDExpChannel': ({'PoolElement', 'ExpChannel', 'ZeroDExpChannel', 'Element', 'Acquirable', 'Object', 'PoolObject'}, 'A 0D experimental channel')}

a dictionary containing the all interfaces supported by each type (dict <str, set < str> >)

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 (str or None or DataType) – the data type to be transformed
Returns:a tuple <str, DataFormat> for the given dtype
Return type:tuple<str, DataFormat>
from_access_str(access)[source]

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

Parameters:dtype (str) – the access to be transformed
Returns:a simple string for the given access
Return type:str
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 (str or seq<str> or seq<seq<str>>) – the data information to be transformed
Returns:a tuple <DataType, DataFormat> for the given data
Return type:tuple<DataType, DataFormat>
to_daccess(daccess)[source]

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

Parameters:dtype (str) – the access to be transformed
Returns:a DataAccess for the given access
Return type:DataAccess