controller
¶
This module contains the definition of the Controller base classes
Constants
-
Type
= 'type'¶ Constant data type (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
-
Access
= 'r/w type'¶ Constant data access (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
-
Description
= 'description'¶ Constant description (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
-
DefaultValue
= 'defaultvalue'¶ Constant default value (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
-
FGet
= 'fget'¶ Constant for getter function (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
-
FSet
= 'fset'¶ Constant for setter function (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
-
Memorize
= 'memorized'¶ Constant memorize (to be used as a key in the definition of
axis_attributes
orctrl_attributes
) Possible values for this key areMemorized
,MemorizedNoInit
andNotMemorized
-
Memorized
= 'true'¶ Constant memorized (to be used as a value in the
Memorize
field definition inaxis_attributes
orctrl_attributes
)
-
MemorizedNoInit
= 'true_without_hard_applied'¶ Constant memorize but not write at initialization (to be used as a value in the
Memorize
field definition inaxis_attributes
orctrl_attributes
)
-
NotMemorized
= 'false'¶ Constant not memorize (to be used as a value in the
Memorize
field definition inaxis_attributes
orctrl_attributes
)
-
MaxDimSize
= 'maxdimsize'¶ Constant MaxDimSize (to be used as a key in the definition of
axis_attributes
orctrl_attributes
)
Interfaces
Classes
Readable interface¶
-
class
Readable
[source]¶ Bases:
object
A Readable interface. A controller for which it’s axis are ‘readable’ (like a motor, counter or 1D for example) should implement this interface
-
PreReadAll
()[source]¶ Controller API. Override if necessary. Called to prepare a read of the value of all axis. Default implementation does nothing.
-
PreReadOne
(axis)[source]¶ Controller API. Override if necessary. Called to prepare a read of the value of a single axis. Default implementation does nothing.
Parameters: axis (int) – axis number
-
ReadAll
()[source]¶ Controller API. Override if necessary. Called to read the value of all selected axis Default implementation does nothing.
-
ReadOne
(axis)[source]¶ Controller API. Override is MANDATORY! Default implementation raises
NotImplementedError
Parameters: axis (int) – axis number Returns: the axis value Return type: object
-
Startable interface¶
-
class
Startable
[source]¶ Bases:
object
A Startable interface. A controller for which it’s axis are ‘startable’ (like a motor, for example) should implement this interface
-
PreStartAll
()[source]¶ Controller API. Override if necessary. Called to prepare a start of all axis (whatever pre-start means). Default implementation does nothing.
-
PreStartOne
(axis, value)[source]¶ Controller API. Override if necessary. Called to prepare a start of the given axis (whatever pre-start means). Default implementation returns True.
Parameters: Returns: True means a successfull pre-start or False for a failure
Return type:
-
StartOne
(axis, value)[source]¶ Controller API. Override if necessary. Called to do a start of the given axis (whatever start means). Default implementation raises
NotImplementedError
Parameters:
-
Stopable interface¶
-
class
Stopable
[source]¶ Bases:
object
A Stopable interface. A controller for which it’s axis are ‘stoppable’ (like a motor, for example) should implement this interface
-
PreAbortAll
()[source]¶ Controller API. Override if necessary. Called to prepare a abort of all axis (whatever pre-abort means). Default implementation does nothing.
-
PreAbortOne
(axis)[source]¶ Controller API. Override if necessary. Called to prepare a abort of the given axis (whatever pre-abort means). Default implementation returns True.
Parameters: axis (int) – axis number Returns: True means a successfull pre-abort or False for a failure Return type: bool
-
AbortOne
(axis)[source]¶ Controller API. Override is MANDATORY! Default implementation raises
NotImplementedError
. Aborts one of the axisParameters: axis (int) – axis number
-
AbortAll
()[source]¶ Controller API. Override if necessary. Aborts all active axis of this controller. Default implementation does nothing.
-
PreStopAll
()[source]¶ Controller API. Override if necessary. Called to prepare a stop of all axis (whatever pre-stop means). Default implementation does nothing.
-
PreStopOne
(axis)[source]¶ Controller API. Override if necessary. Called to prepare a stop of the given axis (whatever pre-stop means). Default implementation returns True.
Parameters: axis (int) – axis number Returns: True means a successfull pre-stop or False for a failure Return type: bool
-
Loadable interface¶
-
class
Loadable
[source]¶ Bases:
object
A Loadable interface. A controller for which it’s axis are ‘loadable’ (like a counter, 1D or 2D for example) should implement this interface
-
PreLoadAll
()[source]¶ Controller API. Override if necessary. Called to prepare loading the integration time / monitor value. Default implementation does nothing.
-
PreLoadOne
(axis, value, repetitions)[source]¶ Controller API. Override if necessary. Called to prepare loading the master channel axis with the integration time / monitor value. Default implementation returns True.
Parameters: Returns: True means a successfull PreLoadOne or False for a failure
Return type:
-
LoadAll
()[source]¶ Controller API. Override if necessary. Called to load the integration time / monitor value. Default implementation does nothing.
-
LoadOne
(axis, value, repetitions)[source]¶ Controller API. Override is MANDATORY! Called to load the integration time / monitor value. Default implementation raises
NotImplementedError
.Parameters:
-
Synchronizer interface¶
-
class
Synchronizer
[source]¶ Bases:
object
A Synchronizer interface. A controller for which its axis are ‘Able to Synchronize’ should implement this interface
-
PreSynchAll
()[source]¶ Controller API. Override if necessary. Called to prepare loading the synchronization description. Default implementation does nothing.
-
PreSynchOne
(axis, description)[source]¶ Controller API. Override if necessary. Called to prepare loading the axis with the synchronization description. Default implementation returns True.
Parameters: - axis (int) – axis number
- list<dict> – synchronization description
Returns: True means a successfull PreSynchOne or False for a failure
Return type:
-
SynchAll
()[source]¶ Controller API. Override if necessary. Called to load the synchronization description. Default implementation does nothing.
-
SynchOne
(axis, description)[source]¶ Controller API. Override is MANDATORY! Called to load the axis with the synchronization description. Default implementation raises
NotImplementedError
.Parameters: - axis (int) – axis number
- description (list<dict>) – synchronization description
-
Abstract Controller¶
-
class
Controller
(inst, props, *args, **kwargs)[source]¶ Bases:
object
Base controller class. Do NOT inherit from this class directly
Parameters: -
class_prop
= {}¶ Deprecated since version 1.0.
use
ctrl_properties
instead
-
ctrl_extra_attributes
= {}¶ Deprecated since version 1.0.
use
axis_attributes
instead
-
ctrl_properties
= {}¶ A
dict
containing controller properties where:key : (
str
) controller property namevalue :
dict
with with threestr
keys (“type”, “description” and “defaultvalue” case insensitive):- for
Type
, value is one of the values described in Data Type definition - for
Description
, value is astr
description of the property. if is not given it defaults to empty string. - for
DefaultValue
, value is a python object or None if no default value exists for the property.
- for
Example:
from sardana.pool.controller import MotorController, \ Type, Description, DefaultValue class MyCtrl(MotorController): ctrl_properties = \ { 'host' : { Type : str, Description : "host name" }, 'port' : { Type : int, Description : "port number", DefaultValue: 5000 } }
-
ctrl_attributes
= {}¶ A
dict
containning controller extra attributes where:key : (
str
) controller attribute namevalue :
dict
withstr
possible keys: “type”, “r/w type”, “description”, “fget”, “fset” and “maxdimsize” (case insensitive):for
Type
, value is one of the values described in Data Type definitionfor
Access
, value is one ofDataAccess
(“read” or “read_write” (case insensitive) strings are also accepted) [default: ReadWrite]for
Description
, value is astr
description of the attribute [default: “” (empty string)]for
FGet
, value is astr
with the method name for the attribute getter [default: “get”<controller attribute name>]for
FSet
, value is astr
with the method name for the attribute setter. [default, ifAccess
= “read_write”: “set”<controller attribute name>]for
DefaultValue
, value is a python object or None if no default value exists for the attribute. If given, the attribute is set when the controller is first created.for
Memorize
, value is astr
with possible values:Memorized
,MemorizedNoInit
andNotMemorized
[default:Memorized
]New in version 1.1.
- for
MaxDimSize
, value is atuple
with possible values: - for scalar must be an empty tuple ( () or [] ) [default: ()]
- for 1D arrays a sequence with one value (example: (1024,)) [default: (2048,)]
- for 1D arrays a sequence with two values (example: (1024, 1024)) [default: (2048, 2048)]
New in version 1.1.
- for
New in version 1.0.
Example:
from sardana.pool.controller import PseudoMotorController, \ Type, Description, DefaultValue, DataAccess class HKLCtrl(PseudoMotorController): ctrl_attributes = \ { 'ReflectionMatrix' : { Type : ( (float,), ), Description : "The reflection matrix", Access : DataAccess.ReadOnly, FGet : 'getReflectionMatrix', }, } def getReflectionMatrix(self): return ( (1.0, 0.0), (0.0, 1.0) )
-
axis_attributes
= {}¶ A
dict
containning controller extra attributes for each axis where:key : (
str
) axis attribute namevalue :
dict
with threestr
keys (“type”, “r/w type”, “description” case insensitive):for
Type
, value is one of the values described in Data Type definitionfor
Access
, value is one ofDataAccess
(“read” or “read_write” (case insensitive) strings are also accepted)for
Description
, value is astr
description of the attributefor
DefaultValue
, value is a python object or None if no default value exists for the attribute. If given, the attribute is set when the axis is first created.for
Memorize
, value is astr
with possible values:Memorized
,MemorizedNoInit
andNotMemorized
[default:Memorized
]New in version 1.1.
- for
MaxDimSize
, value is atuple
with possible values: - for scalar must be an empty tuple ( () or [] ) [default: ()]
- for 1D arrays a sequence with one value (example: (1024,)) [default: (2048,)]
- for 1D arrays a sequence with two values (example: (1024, 1024)) [default: (2048, 2048)]
New in version 1.1.
- for
New in version 1.0.
Example:
from sardana.pool.controller import MotorController, \ Type, Description, DefaultValue, DataAccess class MyMCtrl(MotorController): axis_attributes = \ { 'EncoderSource' : { Type : str, Description : 'motor encoder source', }, } def getAxisPar(self, axis, name): name = name.lower() if name == 'encodersource': return self._encodersource[axis] def setAxisPar(self, axis, name, value): name = name.lower() if name == 'encodersource': self._encodersource[axis] = value
-
standard_axis_attributes
= {}¶ A
dict
containing the standard attributes present on each axis device
-
_findAPIVersion
()[source]¶ Internal. By default return the Pool Controller API version of the pool where the controller is running
-
AddDevice
(axis)[source]¶ Controller API. Override if necessary. Default implementation does nothing.
Parameters: axis (int) – axis number
-
DeleteDevice
(axis)[source]¶ Controller API. Override if necessary. Default implementation does nothing.
Parameters: axis (int) – axis number
-
inst_name
¶ Controller API. The controller instance name.
Deprecated since version 1.0: use
GetName()
instead
-
GetName
()[source]¶ Controller API. The controller instance name.
Returns: the controller instance name Return type: str New in version 1.0.
-
GetAxisName
(axis)[source]¶ Controller API. The axis name.
Returns: the axis name Return type: str New in version 1.0.
-
PreStateAll
()[source]¶ Controller API. Override if necessary. Called to prepare a read of the state of all axis. Default implementation does nothing.
-
PreStateOne
(axis)[source]¶ Controller API. Override if necessary. Called to prepare a read of the state of a single axis. Default implementation does nothing.
Parameters: axis (int) – axis number
-
StateAll
()[source]¶ Controller API. Override if necessary. Called to read the state of all selected axis. Default implementation does nothing.
-
StateOne
(axis)[source]¶ Controller API. Override is MANDATORY. Called to read the state of one axis. Default implementation raises
NotImplementedError
.
-
SetCtrlPar
(parameter, value)[source]¶ Controller API. Override if necessary. Called to set a parameter with a value. Default implementation sets this object member named ‘_’+parameter with the given value.
New in version 1.0.
-
GetCtrlPar
(parameter)[source]¶ Controller API. Override if necessary. Called to set a parameter with a value. Default implementation returns the value contained in this object’s member named ‘_’+parameter.
New in version 1.0.
-
SetAxisPar
(axis, parameter, value)[source]¶ Controller API. Override is MANDATORY. Called to set a parameter with a value on the given axis. Default implementation calls deprecated
SetPar()
which, by default, raisesNotImplementedError
.New in version 1.0.
-
GetAxisPar
(axis, parameter)[source]¶ Controller API. Override is MANDATORY. Called to get a parameter value on the given axis. Default implementation calls deprecated
GetPar()
which, by default, raisesNotImplementedError
.New in version 1.0.
-
SetAxisExtraPar
(axis, parameter, value)[source]¶ Controller API. Override if necessary. Called to set a parameter with a value on the given axis. Default implementation calls deprecated
SetExtraAttributePar()
which, by default, raisesNotImplementedError
.New in version 1.0.
-
GetAxisExtraPar
(axis, parameter)[source]¶ Controller API. Override if necessary. Called to get a parameter value on the given axis. Default implementation calls deprecated
GetExtraAttributePar()
which, by default, raisesNotImplementedError
.New in version 1.0.
-
SetPar
(axis, parameter, value)[source]¶ Controller API. Called to set a parameter with a value on the given axis. Default implementation raises
NotImplementedError
.Deprecated since version 1.0: use
SetAxisPar()
instead
-
GetPar
(axis, parameter)[source]¶ Controller API. Called to get a parameter value on the given axis. Default implementation raises
NotImplementedError
.Deprecated since version 1.0: use
GetAxisPar()
instead
-
SetExtraAttributePar
(axis, parameter, value)[source]¶ Controller API. Called to set a parameter with a value on the given axis. Default implementation raises
NotImplementedError
.Deprecated since version 1.0: use
SetAxisExtraPar()
instead
-
GetExtraAttributePar
(axis, parameter)[source]¶ Controller API. Called to get a parameter value on the given axis. Default implementation raises
NotImplementedError
.Deprecated since version 1.0: use
GetAxisExtraPar()
instead
-
GetAxisAttributes
(axis)[source]¶ Controller API. Override if necessary. Returns a dictionary of all attributes per axis. Default implementation returns a new
dict
with the standard attributes plus theaxis_attributes
Parameters: axis (int) – axis number Returns: a dict containing attribute information as defined in axis_attributes
New in version 1.0.
-
SendToCtrl
(stream)[source]¶ Controller API. Override if necessary. Sends a string to the controller. Default implementation raises
NotImplementedError
.Parameters: stream (str) – stream to be sent Returns: any relevant information e.g. response of the controller Return type: str
-
Abstract Pseudo Controller¶
-
class
PseudoController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
Base class for all pseudo controllers.
Motor Controller API¶
-
class
MotorController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
,sardana.pool.controller.Startable
,sardana.pool.controller.Stopable
,sardana.pool.controller.Readable
Base class for a motor controller. Inherit from this class to implement your own motor controller for the device pool.
A motor controller should support these axis parameters:
- acceleration
- deceleration
- velocity
- base_rate
- step_per_unit
These parameters are configured through the
GetAxisPar()
/SetAxisPar()
API (in version <1.0 the methods were calledGetPar()
/SetPar()
. DefaultGetAxisPar()
andSetAxisPar()
still callGetPar()
andSetPar()
respectively in order to maintain backward compatibility).-
NoLimitSwitch
= 0¶ A constant representing no active switch.
-
HomeLimitSwitch
= 1¶ A constant representing an active home switch. You can OR two or more switches together. For example, to say both upper and lower limit switches are active:
limit_switches = self.HomeLimitSwitch | self.LowerLimitSwitch
-
UpperLimitSwitch
= 2¶ A constant representing an active upper limit switch. You can OR two or more switches together. For example, to say both upper and lower limit switches are active:
limit_switches = self.UpperLimitSwitch | self.LowerLimitSwitch
-
LowerLimitSwitch
= 4¶ A constant representing an active lower limit switch. You can OR two or more switches together. For example, to say both upper and lower limit switches are active:
limit_switches = self.UpperLimitSwitch | self.LowerLimitSwitch
-
standard_axis_attributes
= {'Acceleration': {'type': <type 'float'>, 'description': 'Acceleration time (s)'}, 'Backlash': {'type': <type 'float'>, 'description': 'Backlash'}, 'Base_rate': {'type': <type 'float'>, 'description': 'Base rate'}, 'Deceleration': {'type': <type 'float'>, 'description': 'Deceleration time (s)'}, 'DialPosition': {'type': <type 'float'>, 'description': 'Dial Position'}, 'Limit_switches': {'type': (<type 'bool'>,), 'description': "This attribute is the motor limit switches state. It's an array with 3 \nelements which are:\n0 - The home switch\n1 - The upper limit switch\n2 - The lower limit switch\nFalse means not active. True means active"}, 'Offset': {'type': <type 'float'>, 'description': 'Offset'}, 'Position': {'type': <type 'float'>, 'description': 'Position'}, 'Sign': {'type': <type 'float'>, 'description': 'Sign'}, 'Step_per_unit': {'type': <type 'float'>, 'description': 'Steps per unit'}, 'Velocity': {'type': <type 'float'>, 'description': 'Velocity'}}¶ A
dict
containing the standard attributes present on each axis device
-
GetAxisAttributes
(axis)[source]¶ Motor Controller API. Override if necessary. Returns a sequence of all attributes per axis. Default implementation returns a
dict
containning:- Position
- DialPosition
- Offset
- Sign
- Step_per_unit
- Acceleration
- Deceleration
- Base_rate
- Velocity
- Backlash
- Limit_switches
plus all attributes contained in
axis_attributes
Note
Normally you don’t need to Override this method. You just implement the class member
axis_attributes
. Typically, you will need to Override this method in two cases:- certain axes contain a different set of extra attributes
which cannot be simply defined in
axis_attributes
- some axes (or all) don’t implement a set of standard moveable parameters (ex.: if a motor controller is created to control a power supply, it may have a position (current) and a velocity (ramp speed) but it may not have acceleration)
Parameters: axis (int) – axis number Returns: a dict containing attribute information as defined in axis_attributes
New in version 1.0.
Pseudo Motor Controller API¶
-
class
PseudoMotorController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.PseudoController
Base class for a pseudo motor controller. Inherit from this class to implement your own pseudo motor controller for the device pool.
Every Pseudo Motor implementation must be a subclass of this class. Current procedure for a correct implementation of a Pseudo Motor class:
- mandatory:
- define the class level attributes
pseudo_motor_roles
,motor_roles
- write
CalcPseudo()
method - write
CalcPhysical()
method.
- define the class level attributes
- optional:
- write
CalcAllPseudo()
andCalcAllPhysical()
if great performance gain can be achived
- write
-
pseudo_motor_roles
= ()¶ a sequence of strings describing the role of each pseudo motor axis in this controller
-
motor_roles
= ()¶ a sequence of strings describing the role of each motor in this controller
-
standard_axis_attributes
= {'Position': {'type': <type 'float'>, 'description': 'Position'}}¶ A
dict
containing the standard attributes present on each axis device
-
CalcAllPseudo
(physical_pos, curr_pseudo_pos)[source]¶ Pseudo Motor Controller API. Override if necessary. Calculates the positions of all pseudo motors that belong to the pseudo motor system from the positions of the physical motors. Default implementation does a loop calling
PseudoMotorController.calc_pseudo()
for each pseudo motor role.Parameters: - physical_pos (sequence<float>) – a sequence containing physical motor positions
- curr_pseudo_pos (sequence<float>) – a sequence containing the current pseudo motor positions
Returns: a sequece of pseudo motor positions (one for each pseudo motor role)
Return type: sequence<float>
New in version 1.0.
-
CalcAllPhysical
(pseudo_pos, curr_physical_pos)[source]¶ Pseudo Motor Controller API. Override if necessary. Calculates the positions of all motors that belong to the pseudo motor system from the positions of the pseudo motors. Default implementation does a loop calling
PseudoMotorController.calc_physical()
for each motor role.Parameters: - pseudo_pos (sequence<float>) – a sequence containing pseudo motor positions
- curr_physical_pos (sequence<float>) – a sequence containing the current physical motor positions
Returns: a sequece of motor positions (one for each motor role)
Return type: sequence<float>
New in version 1.0.
-
CalcPseudo
(axis, physical_pos, curr_pseudo_pos)[source]¶ Pseudo Motor Controller API. Override is MANDATORY. Calculate pseudo motor position given the physical motor positions
Parameters: - axis (int) – the pseudo motor role axis
- physical_pos (sequence<float>) – a sequence containing motor positions
- curr_pseudo_pos (sequence<float>) – a sequence containing the current pseudo motor positions
Returns: a pseudo motor position corresponding to the given axis pseudo motor role
Return type: New in version 1.0.
-
CalcPhysical
(axis, pseudo_pos, curr_physical_pos)[source]¶ Pseudo Motor Controller API. Override is MANDATORY. Calculate physical motor position given the pseudo motor positions.
Parameters: - axis (int) – the motor role axis
- pseudo_pos (sequence<float>) – a sequence containing pseudo motor positions
- curr_physical_pos (sequence<float>) – a sequence containing the current physical motor positions
Returns: a motor position corresponding to the given axis motor role
Return type: New in version 1.0.
-
calc_all_pseudo
(physical_pos)[source]¶ Pseudo Motor Controller API. Override if necessary. Calculates the positions of all pseudo motors that belong to the pseudo motor system from the positions of the physical motors. Default implementation does a loop calling
PseudoMotorController.calc_pseudo()
for each pseudo motor role.Parameters: physical_pos (sequence<float>) – a sequence of physical motor positions Returns: a sequece of pseudo motor positions (one for each pseudo motor role) Return type: sequence<float> Deprecated since version 1.0: implement
CalcAllPseudo()
instead
-
calc_all_physical
(pseudo_pos)[source]¶ Pseudo Motor Controller API. Override if necessary. Calculates the positions of all motors that belong to the pseudo motor system from the positions of the pseudo motors. Default implementation does a loop calling
PseudoMotorController.calc_physical()
for each motor role.Parameters: pseudo_pos (sequence<float>) – a sequence of pseudo motor positions Returns: a sequece of motor positions (one for each motor role) Return type: sequence<float> Deprecated since version 1.0: implement
CalcAllPhysical()
instead
-
calc_pseudo
(axis, physical_pos)[source]¶ Pseudo Motor Controller API. Override is MANDATORY. Calculate pseudo motor position given the physical motor positions
Parameters: - axis (int) – the pseudo motor role axis
- physical_pos (sequence<float>) – a sequence of motor positions
Returns: a pseudo motor position corresponding to the given axis pseudo motor role
Return type: Deprecated since version 1.0: implement
CalcPseudo()
instead
-
calc_physical
(axis, pseudo_pos)[source]¶ Pseudo Motor Controller API. Override is MANDATORY. Calculate physical motor position given the pseudo motor positions.
Parameters: - axis (int) – the motor role axis
- pseudo_pos (sequence<float>) – a sequence of pseudo motor positions
Returns: a motor position corresponding to the given axis motor role
Return type: Deprecated since version 1.0: implement
CalcPhysical()
instead
-
GetMotor
(index_or_role)[source]¶ Returns the motor for a given role/index.
Warning
- Use with care: Executing motor methods can be dangerous!
- Since the controller is built before any element (including motors), this method will FAIL when called from the controller constructor
Parameters: index_or_role (int or str) – index number or role name Returns: Motor object for the given role/index Return type: PoolMotor
-
GetPseudoMotor
(index_or_role)[source]¶ Returns the pseudo motor for a given role/index.
Warning
- Use with care: Executing pseudo motor methods can be dangerous!
- Since the controller is built before any element (including pseudo motors), this method will FAIL when called from the controller constructor
Parameters: index_or_role (int or str) – index number or role name Returns: PseudoMotor object for the given role/index Return type: PoolPseudoMotor
Counter Timer Controller API¶
-
class
CounterTimerController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
,sardana.pool.controller.Readable
,sardana.pool.controller.Startable
,sardana.pool.controller.Stopable
,sardana.pool.controller.Loadable
Base class for a counter/timer controller. Inherit from this class to implement your own counter/timer controller for the device pool.
A counter timer controller should support these controller parameters:
- timer
- monitor
- trigger_type
-
standard_axis_attributes
= {'Data': {'type': <type 'str'>, 'description': 'Data'}, 'Value': {'type': <type 'float'>, 'description': 'Value'}}¶ A
dict
containing the standard attributes present on each axis device
-
PreStartAllCT
()[source]¶ Counter/Timer Controller API. Override if necessary. Called to prepare an acquisition of all selected axis. Default implementation does nothing.
Deprecated since version 1.0: use
PreStartAll()
instead
-
PreStartOneCT
(axis)[source]¶ Counter/Timer Controller API. Override if necessary. Called to prepare an acquisition a single axis. Default implementation returns True.
Parameters: axis (int) – axis number Returns: True means a successfull PreStartOneCT or False for a failure Return type: bool Deprecated since version 1.0: use
PreStartOne()
instead
-
StartOneCT
(axis)[source]¶ Counter/Timer Controller API. Override if necessary. Called to start an acquisition of a selected axis. Default implementation does nothing.
Parameters: axis (int) – axis number Deprecated since version 1.0: use
StartOne()
instead
-
StartAllCT
()[source]¶ Counter/Timer Controller API. Override is MANDATORY! Called to start an acquisition of a selected axis. Default implementation raises
NotImplementedError
.Deprecated since version 1.0: use
StartAll()
instead
-
PreStartAll
()[source]¶ Controller API. Override if necessary. Called to prepare a write of the position of all axis. Default implementation calls deprecated
PreStartAllCT()
which, by default, does nothing.New in version 1.0.
-
PreStartOne
(axis, value=None)[source]¶ Controller API. Override if necessary. Called to prepare a write of the position of a single axis. Default implementation calls deprecated
PreStartOneCT()
which, by default, returns True.Parameters: Returns: True means a successfull pre-start or False for a failure
Return type: New in version 1.0.
-
StartOne
(axis, value=None)[source]¶ Controller API. Override if necessary. Called to write the position of a selected axis. Default implementation calls deprecated
StartOneCT()
which, by default, does nothing.Parameters:
-
StartAll
()[source]¶ Controller API. Override is MANDATORY! Default implementation calls deprecated
StartAllCT()
which, by default, raisesNotImplementedError
.
0D Controller API¶
-
class
ZeroDController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
,sardana.pool.controller.Readable
,sardana.pool.controller.Stopable
Base class for a 0D controller. Inherit from this class to implement your own 0D controller for the device pool.
1D Controller API¶
-
class
OneDController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
,sardana.pool.controller.Readable
,sardana.pool.controller.Startable
,sardana.pool.controller.Stopable
,sardana.pool.controller.Loadable
Base class for a 1D controller. Inherit from this class to implement your own 1D controller for the device pool.
New in version 1.2.
-
standard_axis_attributes
= {'Data': {'type': <type 'str'>, 'description': 'Data'}, 'Value': {'maxdimsize': (16384,), 'type': (<type 'float'>,), 'description': 'Value'}}¶
-
GetAxisPar
(axis, parameter)[source]¶ Controller API. Override is MANDATORY. Called to get a parameter value on the given axis. If parameter == ‘data_source’, default implementation returns None, meaning let sardana decide the proper URI for accessing the axis value. Otherwise, default implementation calls deprecated
GetPar()
which, by default, raisesNotImplementedError
.New in version 1.2.
-
2D Controller API¶
-
class
TwoDController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
,sardana.pool.controller.Readable
,sardana.pool.controller.Startable
,sardana.pool.controller.Stopable
,sardana.pool.controller.Loadable
Base class for a 2D controller. Inherit from this class to implement your own 2D controller for the device pool.
-
standard_axis_attributes
= {'Value': {'maxdimsize': (4096, 4096), 'type': ((<type 'float'>,),), 'description': 'Value'}}¶
-
GetAxisPar
(axis, parameter)[source]¶ Controller API. Override is MANDATORY. Called to get a parameter value on the given axis. If parameter == ‘data_source’, default implementation returns None, meaning let sardana decide the proper URI for accessing the axis value. Otherwise, default implementation calls deprecated
GetPar()
which, by default, raisesNotImplementedError
.New in version 1.2.
-
Pseudo Counter Controller API¶
-
class
PseudoCounterController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
Base class for a pseudo counter controller. Inherit from this class to implement your own pseudo counter controller for the device pool.
Every Pseudo Counter implementation must be a subclass of this class. Current procedure for a correct implementation of a Pseudo Counter class:
- mandatory:
- define the class level attributes
counter_roles
, - write
Calc()
method
- define the class level attributes
-
pseudo_counter_roles
= ()¶ a sequence of strings describing the role of each pseudo counter axis in this controller
-
counter_roles
= ()¶ a sequence of strings describing the role of each counter in this controller
-
standard_axis_attributes
= {'Data': {'type': <type 'str'>, 'description': 'Data'}, 'Value': {'type': <type 'float'>, 'description': 'Value'}}¶ A
dict
containing the standard attributes present on each axis device
-
Calc
(axis, values)[source]¶ Pseudo Counter Controller API. Override is MANDATORY. Calculate pseudo counter position given the counter values.
Parameters: - axis (int) – the pseudo counter role axis
- values (sequence<float>) – a sequence containing current values of underlying elements
Returns: a pseudo counter value corresponding to the given axis pseudo counter role
Return type: New in version 1.0.
-
calc
(axis, values)[source]¶ Pseudo Counter Controller API. Override is MANDATORY. Calculate pseudo counter value given the counter values.
Parameters: - axis (int) – the pseudo counter role axis
- values (sequence<float>) – a sequence containing current values of underlying elements
Returns: a pseudo counter value corresponding to the given axis pseudo counter role
Return type: Deprecated since version 1.0: implement
Calc()
instead
-
CalcAll
(values)[source]¶ Pseudo Counter Controller API. Override if necessary. Calculates all pseudo counter values from the values of counters. Default implementation does a loop calling
PseudoCounterController.Calc()
for each pseudo counter role.Parameters: values (sequence<float>) – a sequence containing current values of underlying elements Returns: a sequece of pseudo counter values (one for each pseudo counter role) Return type: sequence<float> New in version 1.2.
IO Register Controller API¶
-
class
IORegisterController
(inst, props, *args, **kwargs)[source]¶ Bases:
sardana.pool.controller.Controller
,sardana.pool.controller.Readable
Base class for a IORegister controller. Inherit from this class to implement your own IORegister controller for the device pool.
-
predefined_values
= ()¶ Deprecated since version 1.0.
use
axis_attributes
instead
-