Pseudo-Motors control¶
This is the basic Python class using a set of EPICS motors and formulas to create a Pseudo Motor.
Using EPICS Pseudo-Motors control module¶
Usage of Python class for Pseudo-Motors control.
-
class
py4syn.epics.PseudoMotorClass.
PseudoMotor
(mnemonic, description, backwardFormula, forwardFormulasDict)[source]¶ Class to control Pseudo-Motor (virtual Motor).
Examples
>>> from py4syn.epics.PseudoMotorClass import PseudoMotor >>> >>> def createPseudoMotor(mnemonic="", description="", backwardFormula="", forwardFormulasDict= []): ... ... new_pseudo_motor = '' ... ... try: ... new_motor = PseudoMotor("motorName", "pseudo-motor to help controlling experiment", "", []) ... print "Motor " + pvName + " created with success!" ... except Exception,e: ... print "Error: ",e ... ... return new_pseudo_motor
Pseudo Motor class Constructor
Parameters: - mnemonic : string
Motor mnemonic
- description : string
Motor Description
- backwardFormula : string
Mathematical Formula used to calculate the Pseudo motor position based on other motors
- forwardFormulasDict : dictionary
Dictionary containing mathematical relations to move each of the motors involved in the pseudo motor movement
-
canPerformMovement
(target)[source]¶ Check if a movement to a given position is possible using the limit values and backlash distance
Returns: - `boolean`
- .. note::
- True – Motor CAN perform the desired movement;
- False – Motor CANNOT perform the desired movement.
-
getBacklashDistanceValue
()[source]¶ Read the motor backlash distance based on the BDST (Backlash Distance, EGU) field of virtual Motor
Returns: - `double`
-
getDescription
()[source]¶ Read the motor description based on the DESC (Description) field of virtual Motor
Returns: - `string`
-
getDialHighLimitValue
()[source]¶ Read the motor dial high limit based on the DHLM (Dial High Limit) field of virtual Motor
Returns: - `double`
-
getDialLowLimitValue
()[source]¶ Read the motor dial low limit based on the DLLM (Dial Low Limit) field of virtual Motor
Returns: - `double`
-
getDialPosition
()[source]¶ Read the motor target DIAL position based on the DVAL (Dial Desired Value) field of virtual Motor
Returns: - `double`
-
getDialRealPosition
()[source]¶ Read the motor DIAL real position based on the DRBV (Dial Readback Value) field of virtual Motor
Returns: - `double`
-
getDirection
()[source]¶ Read the Pseudo motor direction
Returns: - `integer`
- .. note::
- Positive direction;
- Negative direction.
-
getEGU
()[source]¶ Read the motor engineering unit based on the EGU (Engineering Units) field of the virtual Motor
Returns: - `string`
-
getFreezeOffset
()[source]¶ Read the motor freeze offset based on the FOF (Freeze Offset) field of virtual Motor
Returns: - `integer`
-
getHighLimitValue
()[source]¶ Read the motor high limit based on the HLM (User High Limit) field of virtual Motor
Returns: - `double`
-
getLVIO
()[source]¶ Read the motor limit violation LVIO (Limit Violation) field of the virtual Motor
Returns: - `short`
-
getLimitValue
(high)[source]¶ Auxiliary method called by
getHighLimitValue()
andgetLowLimitValue()
to get the high and low limit values of a pseudo motor. The limits are calculated based on a maximization or minimization, depending on the high parameter, of the pseudo motor equation, considering the bounds of the real motors.See
getHighLimitValue()
,getLowLimitValue()
Parameters: - high : bool
True if the high limit value is requested, false if the low limit is requested.
Returns: - `double`
-
getLowLimitValue
()[source]¶ Read the motor low limit based on the LLM (User Low Limit) field of virtual Motor
Returns: - `double`
-
getOffset
()[source]¶ Read the motor offset based on the OFF (User Offset, EGU) field of virtual Motor
Returns: - `string`
-
getPosition
()[source]¶ Read the motor target position based on the VAL (User Desired Value) field of virtual Motor
Returns: - `double`
-
getRawPosition
()[source]¶ Read the motor RAW position based on the RVAL (Raw Desired Value) field of Motor Record
Returns: - `double`
-
getRawRealPosition
()[source]¶ Read the motor RAW real position based on the RRBV (Raw Readback Value) field of Motor Record
Returns: - `double`
-
getRealPosition
()[source]¶ Read the motor real position based on the RBV (User Readback Value) field of virtual Motor
Returns: - `double`
-
getValue
()[source]¶ Get the current position of the motor. See
py4syn.epics.IScannable
Returns: - `double`
Read the current value (virtual Motor Real Position)
-
getVariableOffset
()[source]¶ Read the motor variable offset based on the VOF (Variable Offset) field of virtual Motor
Returns: - `integer`
-
isAtHighLimitSwitch
()[source]¶ Check if the high limit switch of any of the motors is activated
Returns: - `int`
- .. note::
- 1 – At least one Motor is at High Limit;
- 0 – NO one of the Motors is at High Limit.
-
isAtLowLimitSwitch
()[source]¶ Check if the low limit switch of any of the motors is activated
Returns: - `int`
- .. note::
- 1 – At least one Motor is at Low Limit;
- 0 – NO one of the Motors is at Low Limit.
-
isMoving
()[source]¶ Check if any of the motors are moving
Returns: - `boolean`
- .. note::
- True – At least one Motor is being moved;
- False – NO one of the Motors is being moved.
-
setAbsolutePosition
(pos, waitComplete=False)[source]¶ Move the motor to an absolute position received by an input parameter
Parameters: - pos : double
The desired position to set
- waitComplete : boolean (default is False)
Note
If True, the function will wait until the movement finish to return, otherwise don’t.
-
setAcceleration
(accl)[source]¶ Set the motor acceleration time based on the ACCL (Seconds to Velocity) field from virtual Motor
Parameters: - accl : double
The desired acceleration to set
-
setDialHighLimitValue
(val)[source]¶ Set the motor dial high limit based on the DHLM (Dial High Limit) field of virtual Motor
Parameters: - val : double
The desired value to set
-
setDialLowLimitValue
(val)[source]¶ Set the motor dial low limit based on the DLLM (Dial Low Limit) field of virtual Motor
Parameters: - val : double
The desired value to set
-
setDialPosition
(pos, waitComplete=False)[source]¶ Set the motor target DIAL position based on the DVAL (Dial Desired Value) field of virtual Motor
Parameters: - pos : double
The desired position to set
- waitComplete : boolean (default is False)
Note
If True, the function will wait until the movement finish to return, otherwise don’t.
-
setEGU
(unit)[source]¶ Set the motor engineering unit to the EGU (Engineering Units) field of virtual Motor
Parameters: - unit : string
The desired engineering unit.
Note
Example: “mm.”, “deg.”
-
setFreezeOffset
(val)[source]¶ Set the motor freeze offset based on the FOF (Freeze Offset) field of virtual Motor
Parameters: - val : integer
The desired value to set
-
setHighLimitValue
(val)[source]¶ Set the motor high limit based on the HLM (User High Limit) field of virtual Motor
Parameters: - val : double
The desired value to set
-
setLowLimitValue
(val)[source]¶ Set the motor low limit based on the LLM (User Low Limit) field of virtual Motor
Parameters: - val : double
The desired value to set
-
setOffset
(val)[source]¶ Set the motor offset based on the OFF (User Offset, EGU) field of virtual Motor
Parameters: - val : double
The desired value to set
-
setRelativePosition
(pos, waitComplete=False)[source]¶ Move the motor a distance, received by an input parameter, to a position relative to that current one
Parameters: - pos : double
The desired distance to move based on current position
- waitComplete : boolean (default is False)
-
setUpdateRequest
(val)[source]¶ Set the motor update request flag based on the STUP (Status Update Request) field from virtual Motor
Parameters: - val : integer
The desired value to set for the flag
-
setValue
(v)[source]¶ Set the desired motor position. See
py4syn.epics.IScannable
Parameters: - v : double
The desired value (Absolute Position) to set
-
setVariableOffset
(val)[source]¶ Set the motor variable offset based on the VOF (Variable Offset) field of virtual Motor
Parameters: - val : integer
The desired value to set
-
setVelocity
(velo)[source]¶ Set the motor velocity up based on the VELO (Velocity, EGU/s) field from virtual Motor
Parameters: - velo : double
The desired velocity to set
-
class
py4syn.epics.PseudoMotorClass.
motorPosition
[source]¶ Class to globally control positioning of virtual Motor
-
__getitem__
(m)[source]¶ Get current value of the virtual Motor positionin
Parameters: - m : dictionary
Represents the device, virtual Motor, in the mtrDB global array of devices
Returns: - `double`
Read the current value (virtual Motor Real Position)
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
class
py4syn.epics.PseudoMotorClass.
motorPositionDial
[source]¶ Class to globally control positioning of virtual Motor using Dial fields
-
__getitem__
(m)[source]¶ Get current value of the virtual Motor positioning using Dial field
Parameters: - m : dictionary
Represents the device, virtual Motor, in the mtrDB global array of devices
Returns: - `double`
Read the current Positioning value of virtual Motor (Real) using Dial field
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
class
py4syn.epics.PseudoMotorClass.
motorTarget
[source]¶ Class to globally control virtual Motor targets
Constructor
Parameters: - None
-
__getitem__
(m)[source]¶ Get current value of the virtual Motor positioning
Parameters: - m : dictionary
Represents the device target, virtual Motor, in the mtrDB global array of devices
Returns: - `double` or `dictionary` item
Read the current Positioning value of virtual Motor (Real)
Note
If m parameter is received and it is in the targets list, then its correspondent target is returned (as a dictionary item), otherwise, real position of virtual Motor is returned (as a double value)
-
__setitem__
(m, pos)[source]¶ Set a position value to the virtual Motor target received as input parameter
Parameters: - m : dictionary
Represents the target device, virtual Motor, in the mtrDB global array of devices
- pos : double
The desired position to set
-
__weakref__
¶ list of weak references to the object (if defined)
-
class
py4syn.epics.PseudoMotorClass.
motorTargetDial
[source]¶ Class to globally control virtual Motor target using Dial fields
Constructor
Parameters: - None
-
__getitem__
(m)[source]¶ Get current value of the virtual Motor positioning using Dial field
Parameters: - m : dictionary
Represents the device target, virtual Motor, in the mtrDB global array of devices
Returns: - `double` or `dictionary` item
Read the current Positioning value of virtual Motor (Real)
Note
If m parameter is received and it is in the targets list, then its correspondent target is returned (as a dictionary item), otherwise, real position of virtual Motor, using the Dial field, is returned (as a double value)
-
__setitem__
(m, pos)[source]¶ Set a position value to the virtual Motor target received as input parameter
Parameters: - m : dictionary
Represents the target device, virtual Motor, in the mtrDB global array of devices
- pos : double
The desired position to set
-
__weakref__
¶ list of weak references to the object (if defined)