Ready-to-Use Devices¶
These devices are have ready-made classes in Python. To configure them, the user need only provide a PV prefix and a name.
EpicsMotor¶
Create an EpicsMotor
to communicate with a single EPICS motor record:
from ophyd import EpicsMotor
# the two-theta motor
tth = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:2ThI}Mtr', name='tth')
-
class
ophyd.epics_motor.
EpicsMotor
(prefix='', *, name, kind=None, read_attrs=None, configuration_attrs=None, parent=None, **kwargs)¶ An EPICS motor record, wrapped in a
Positioner
Keyword arguments are passed through to the base class, Positioner
Parameters: - prefix : str
The record to use
- read_attrs : sequence of attribute names
The signals to be read during data acquisition (i.e., in read() and describe() calls)
- name : str, optional
The name of the device
- parent : instance or None
The instance of the parent device, if applicable
- settle_time : float, optional
The amount of time to wait after moves to report status completion
- timeout : float, optional
The default timeout to use for motion requests, in seconds.
-
check_value
(pos)¶ Check that the position is within the soft limits
-
egu
¶ The engineering units (EGU) for a position
-
get_lim
(flag)¶ Returns the travel limit of motor
- flag > 0: returns high limit
- flag < 0: returns low limit
- flag == 0: returns None
Included here for compatibility with similar with SPEC command.
Parameters: - high : float
Limit of travel in the positive direction.
- low : float
Limit of travel in the negative direction.
-
home
(direction, wait=True, **kwargs)¶ Perform the default homing function in the desired direction
Parameters: - direction : HomeEnum
Direction in which to perform the home search.
-
move
(position, wait=True, **kwargs)¶ Move to a specified position, optionally waiting for motion to complete.
Parameters: - position
Position to move to
- moved_cb : callable
Call this callback when movement has finished. This callback must accept one keyword argument: ‘obj’ which will be set to this positioner instance.
- timeout : float, optional
Maximum time to wait for the motion. If None, the default timeout for this positioner is used.
Returns: - status : MoveStatus
Raises: - TimeoutError
When motion takes longer than timeout
- ValueError
On invalid positions
- RuntimeError
If motion fails other than timing out
-
moving
¶ Whether or not the motor is moving
Returns: - moving : bool
-
position
¶ The current position of the motor in its engineering units
Returns: - position : float
-
precision
¶ The precision of the readback PV, as reported by EPICS
-
set_current_position
(pos)¶ Configure the motor user position to the given value
Parameters: - pos
Position to set.
-
set_lim
(low, high)¶ Sets the low and high travel limits of motor
- No action taken if motor is moving.
- Low limit is set to lesser of (low, high)
- High limit is set to greater of (low, high)
Included here for compatibility with similar with SPEC command.
Parameters: - high : float
Limit of travel in the positive direction.
- low : float
Limit of travel in the negative direction.
EpicsScaler¶
Create an EpicsScaler
to control an EPICS scaler record:
from ophyd import EpicsScaler
scaler = EpicsScaler('XF:28IDC-ES:1{Sclr:1}', name='tth')
-
class
ophyd.scaler.
EpicsScaler
(*args, **kwargs)¶ SynApps Scaler Record interface
EpicsMCA and EpicsDXP¶
MCA records and
DXP-based devices are also supported, through the EpicsMCA
and EpicsDXP
devices.
-
class
ophyd.mca.
EpicsMCARecord
(*args, **kwargs)¶ SynApps MCA Record interface
-
class
ophyd.mca.
EpicsDXP
(prefix='', *, name, kind=None, read_attrs=None, configuration_attrs=None, parent=None, **kwargs)¶ All high-level DXP parameters for each channel
MotorBundle¶
Creating ‘bundles’ of motors is very common so we also have a helper
class that tweaks the default behavior of read_attrs
,
configuration_attrs
, and hints
-
class
ophyd.epics_motor.
MotorBundle
(prefix='', *, name, kind=None, read_attrs=None, configuration_attrs=None, parent=None, **kwargs)¶ Sub-class this to device a bundle of motors
This provides better default behavior for :ref:
hints
.
This must be sub-classed (like Device
) to be useful.
from ophyd import MotorBundle, EpicsMotor
from ophyd import Component as Cpt
class StageXY(MotorBundle):
x = Cpt(EpicsMotor, ':X')
y = Cpt(EpicsMotor, ':Y')
stage = StageXY('STAGE_PV', name='stage')