Devices

An MxDC Device is a high-level abstraction of a beamline hardware device that allows MxDC to interact with the hardware. From our perspective, the only relevant details are those important for the function that is common across all devices of the same type.

Devices of the same type are expected to provide a minimum common subset of functions and behaviours that determine the interface of the device. The interface for the device type is therefore a common set of attributes, methods, signals and behaviours.

All devices in MxDC are derived from the base class mxdc.Device which provides a default set of methods attributes and signals for all device types. Specific device types can be created by subclassing mxdc.Device and adding required methods, signals and attributes.

class mxdc.Device

Base device object. All devices should be derived from this class.

Signals

  • “active”: arg_types=(bool,), True when device is ready to be controlled

  • “busy”: arg_types=(bool,), True when device is busy

  • “enabled”: arg_types=(bool,), True when device is enabled for control

  • “health”: arg_types=(severity: int, context: str, message: str), represents the health state of the device the severity levels are

    • 0: OK,

    • 1: MINOR,

    • 2: MARGINAL,

    • 4: SERIOUS,

    • 8: CRITICAL,

    • 16: DISABLED

add_components(*components)

Add one or more components as children of this device. Components can be other devices.

Parameters

components – components to add to this device

add_features(*features)

Flag the provided features as supported

Parameters

features – features supported by device. Features can be any python object.

add_pv(*args, **kwargs)

Create a new process variable (PV) and add it as a component to the device.

Arguments and Keyworded arguments should be the same as those expected for instantiating the process variable class.

cleanup()

Clean up before shutdown

configure(**kwargs)

Configure the device. Keyword arguments and implementation details are device specific.

get_pending()

Get a list of pending/inactive components

is_active()

Check if the device is active and ready for commands

is_busy()

Check if the device is busy/moving

is_enabled()

Check if the device is enabled/disabled

is_healthy()

Check if all health flags are clear

on_component_active(component, state)

Callback which is processed every time a component becomes active or inactive, and manages the list of pending components.

Parameters
  • component – sub-component

  • state – state of component, True if active, False if inactive

set_state(*args, **kwargs)

Set the state of the object and emit the corresponding signal.

Parameters
  • args – list of strings corresponding to non-value signal names

  • kwargs – name, value pairs corresponding to signal name and signal arguments.

supports(*features)

Check if device supports all of the features specified

Parameters

features – one or more features to check

Returns

bool

The following are some examples of device types included by default. To implement variants of the these built-in device types, simply subclass them and provide implementation details of the interface.

Auto Mounters

Auto mounters provide abstractions for robotic sample mounting systems for loading samples onto beamlines.

class mxdc.devices.automounter.AutoMounter

Base class for all Sample Automounters.

Properties

  • layout: container layout dictionary

  • sample: mounted sample

  • next_port: next port to mount

  • containers: container meta-data

  • status: automounter status

  • failure: failure meta-data

abort()

Abort current operation

cancel()

Cancel Standby state

configure(**kwargs)

Configure the automounter

Parameters

kwargs – Accepted kwargs are the same as the device properties.

dismount(wait=False)

Dismount the currently mounted sample. Must take care of preparing the end station and dismounting any mounted samples before mounting :return: bool, True if successful

is_mountable(port)

Check if the specified port can be mounted successfully

Parameters

port – str representation of the port

Returns

bool, True if it is mounted

is_mounted(port=None)

Check if the specified port is mounted :param port: str representation of the port or None if checking for any :return: bool, True if it is mounted

is_preparing()

Check if the automounter is preparing to start

is_ready()

Check if the automounter is ready for an operation

is_valid(port)

Check if the specified port is a valid port designation for this automounter

Parameters

port – str representation of the port

Returns

bool, True if it is valid

mount(port, wait=False)

Mount the sample at the given port. Must take care of preparing the end station and dismounting any mounted samples before mounting

Parameters
  • port – str, the port to mount

  • wait – bool, whether to block until operation is completed

Returns

bool, True if successful

prefetch(port, wait=False)

For automounters which support pre-fetching. Prefetch the next sample for mounting

Parameters
  • port – next port to mount

  • wait – boolean, wait for prefetch to complete

prepare()

Get ready to start.

recover(failure)

Recover from a specific failure type

Parameters

failure – Failure type

wait(states=(<State.IDLE: 0>, ), timeout=60)

Wait for the given state to be attained

Parameters
  • states – requested state to wait for or a list of states

  • timeout – maximum time to wait

Returns

bool, True if state was attained or False if timeout was exhausted

wait_until(*states, timeout=20.0)

Wait for a maximum amount of time until the state is one of the specified states, or busy if no states are specified.

Parameters
  • states – states to check for. Attaining any of the states will terminate the wait

  • timeout – Maximum time in seconds to wait

Returns

True if state was attained, False if timeout was reached.

wait_while(*states, timeout=20.0)

Wait for a maximum amount of time while the state is one of the specified states, or not busy if no states are specified.

Parameters
  • state – states to check for. Attaining a state other than any of the states will terminate the wait

  • timeout – Maximum time in seconds to wait

Returns

True if state was attained, False if timeout was reached.

Sub-classes

sam.UncleSAM(root)

Auto mounter Device based on the UncleSAM EPICS driver without Blu-ICE.

isara.AuntISARA(root)

Auto mounter Device for the IRELEC ISARA based on the newer AunISARA python-based EPICS driver.

cats.CATS(root)

An abstraction fot the IRELEC CATS Auto Mounter

sim.SimSAM()

Simulated Auto mounter Device which emulates a SAM automounter.

Beam Tuners

class mxdc.devices.boss.BaseTuner

Base device for all Beam Tuners. A beam tuner links to a beam intensity monitor and reports the percentage intensity compared to the expected value for the intensity monitor. It also allows tweak the beam up or down. Optionally it can be an abstraction for a device which performs automated optimization of the beam.

Signals

  • changed (float,): emitted with the current value of the tuner

  • percent (float,): percentage of current value compared to expected

get_value()

Return current value

is_tunable()

Check if Tuner is actually tunable, or just a dummy tuner.

pause()

Pause optimization.

reset()

Reset the beam tuner

resume()

Pause optimization.

start()

Start optimization.

stop()

Stop optimization.

tune_down()

Tweak the beam down.

tune_up()

Tweak the beam up.

Sub-classes

BOSSTuner(name, picoameter, current[, …])

Beam Tuner abstraction for the original ELETTRA Beamline Optimisation and Stabilization System (BOSS).

MOSTABTuner(name, picoameter, current[, …])

Beam Tuner abstraction for the D-MOSTAB beam stabilisation hardware.

SimTuner(name)

A Simulated Beam Tuner

Counters

Counters are simple devices that are continuously monitoring hardware feedback, like temperature, current, voltage, vacuum pressure, etc. Counters provide mechanisms for averaging or integrating those values over peiods of time.

class mxdc.devices.counter.BaseCounter

Base class for all counter devices

Signals

  • changed (object,): value has changed

  • count (float,): result of asynchronous

count(duration)

Integrate of the value for the specified amount of time. Blocks while counting

Parameters

duration – total time duration in seconds to count

Returns

accumulated value

count_async(t)

Non-blocking averaging of the value for the specified amount of time. The result of the count will be available in the “average_count” attribute

Parameters

t – total time to count

start()

Start counting as fast as possible until stopped. Values are be emitted as the “count” signal.

stop()

Stop fast counting

Sub-classes

SimCounter(name[, zero])

Simulated Counter Device objects.

Counter(pv_name[, zero])

EPICS based Counter Device objects.

Detectors

In the context of MxDC, detectors are 2D imaging detector/cameras the acquire series of images.

class mxdc.devices.detector.BaseDetector

Base class for all imaging detector classes

Signals

  • state: (object,), Detector state

  • new-image: (object,), New image recorded

  • progress: (float, str), Progress fraction and message

check(directory, prefix, first=1)

Check the dataset in a given directory and prefix.

Parameters
  • directory – Directory in which to check files

  • prefix – file name prefix

  • first – first frame number, defaults to 1

Returns

tuple with the following sequence of values (list, bool), list of existing frame numbers True if dataset can be resumed, False otherwise

delete(directory, prefix, frames=())

Delete dataset frames given a file name prefix and directory

Parameters
  • directory – Directory in which to delete files

  • prefix – file name prefix

  • frames – list of frame numbers.

get_template(prefix)

Given a file name prefix, generate the file name template for the dataset. This should be a format string specification which takes a single parameter number representing the file number, or no parameter at all, for archive formats like hdf5

Parameters

prefix – file name prefix

Returns

format string

initialize(wait=True)

Initialize the detector :param wait: if True, wait for the detector to complete initialization

process_frame(data)

Process the frame data from a monitor helper

Parameters

data – Dataset object to be processed

set_state(*args, **kwargs)

Set the state of the object and emit the corresponding signal.

Parameters
  • args – list of strings corresponding to non-value signal names

  • kwargs – name, value pairs corresponding to signal name and signal arguments.

wait()

Wait while the detector is busy.

Returns

True if detector became idle or False if wait timed-out.

wait_until(*states, timeout=20.0)

Wait for a maximum amount of time until the detector state is one of the specified states, or busy if no states are specified.

Parameters
  • states – states to check for. Attaining any of the states will terminate the wait

  • timeout – Maximum time in seconds to wait

Returns

True if state was attained, False if timeout was reached.

wait_while(*states, timeout=20.0)

Wait for a maximum amount of time while the detector state is one of the specified states, or not busy if no states are specified.

Parameters
  • state – states to check for. Attaining a state other than any of the states will terminate the wait

  • timeout – Maximum time in seconds to wait

Returns

True if state was attained, False if timeout was reached.

Sub-classes

SimDetector(name, size[, pixel_size, …])

Simulated Detector.

RayonixDetector(name, size[, detector_type, …])

Rayonix Detector devices controlled through the AreaDetector MarCCD EPICS driver.

ADSCDetector(name, size[, detector_type, …])

ADSC Detector devices for the AreaDetector EPICS driver.

PilatusDetector(name[, size, detector_type, …])

Pilatus Detector devices from DECTRIS controlled through the AreaDetector Pilaltus EPICS driver.

EigerDetector(name, stream[, size, description])

Eiger Detector devices from DECTRIS controlled through the AreaDetector EPICS driver.

Goniometers

Goniometers are rotary devices that can be configured to perform scans combined with triggering of detectors for acquiring data.

class mxdc.devices.goniometer.BaseGoniometer(name='Diffractometer')

Base class for all goniometers.

configure(**kwargs)

Configure the goniometer in preparation for scanning.

kwargs:
  • time: exposure time per frame

  • range: angle range

  • angle: start angle of data set

  • frames: total number of frames

scan(**kwargs)

Configure and perform the scan :keyword type: Scan type (str), one of (‘simple’, ‘shutterless’, ‘helical’, ‘vector’, ‘raster’) :keyword wait: boolean whether to wait or not :keyword timeout: maximum time to wait for scan. :keyword time: exposure time :keyword range: scan range in degrees :keyword angle: starting angle for scan :keyword frames: number of frames to acquire during scan, per line for raster scans :keyword start_pos: starting position :keyword end_pos: ending position :keyword passes: Number of exposures per frame :keyword lines: Number of lines for raster scans :keyword width: horizontal size of raster grid :keyword height: vertical size of raster grid

stop()

Stop and abort the current scan if any.

wait(start=True, stop=True, timeout=None)

Wait for the goniometer busy state to change.

Parameters
  • start – (bool), Wait for the goniometer to become busy.

  • stop – (bool), Wait for the goniometer to become idle.

  • timeout – maximum time in seconds to wait before failing.

Returns

(bool), False if wait timed-out

Sub-classes

SimGonio([kappa_enabled, trigger])

Simulated Goniometer.

ParkerGonio(root, xname, y1name, y2name)

EPICS based Parker-type BaseGoniometer at the CLS 08ID-1.

MD2Gonio(root[, kappa_enabled, scan4d, …])

MD2-type BaseGoniometer.

Motors

class mxdc.devices.motor.BaseMotor(name, *args, precision=2, units='')

Base class for motors.

Signals

  • changed: float, Emitted everytime the position of the motor changes. Data contains the current position of the motor.

  • target: float, Emitted everytime the requested position of the motor changes. Data is a tuple containing the previous set point and the current one. Data is a 2-tuple with the current position and the timestamp of the last change.

  • starting: bool, Emitted when this a command to move has been accepted by this instance of the motor.

configure(speed=None, accel=None)

Configure the motor.

Parameters
  • speed – speed value to set, None if no change required

  • accel – acceleration value to set, None if no change required

get_config()

Get the current configuration of the motor as a dictionary.

has_reached(value)

Check if the motor has reached a given position.

Parameters

value – query position

Returns

(boolean)

is_moving()

Check if motor is moving, ie a command has been received.

Returns

True if moving, False otherwise

is_starting()

Check if motor is starting, ie a command has been received but has not yet started moving.

Returns

True if starting, False otherwise

move_by(value, wait=False, force=False)

Similar to move_to(), except request the motor to move by a relative amount.

Parameters
  • value – Relative amount to move position by

  • wait – Whether to block until move is completed or not

  • force – Force move even if already at current position

move_operation(target)

Raw move operation command. Moves the motor to the absolute position. Warning: this method sends the command directy to the device without additional checks. Should not be used directly without additional checks. Subclasses must implement this method.

Parameters

target – Absolute position to move to.

move_to(pos, wait=False, force=False)

Move to an absolute position.

Parameters
  • pos – Target position

  • wait – Block until move is done, default is non-blocking

  • force – Force move even if already at current position

on_calibration(obj, state)

Callback to emit “health” signal changes when the motor calibration changes.

Parameters
  • obj – process variable object

  • value – value of process variable

on_change(obj, value)

Callback to Emit “changed” signals when the motor position changes

Parameters
  • obj – process variable object

  • value – value of process variable

on_enable(obj, val)

Callback to emit “enabled” signal when the motor-enabled state is changed.

Parameters
  • obj – process variable object

  • value – value of process variable

on_motion(obj, value)

Callback to emit “starting” and “busy” signal when the motor starts moving.

Parameters
  • obj – process variable object

  • value – value of process variable

on_target(obj, value)

Callback to emit “target” signal when the motor target is changed.

Parameters
  • obj – process variable object

  • value – value of process variable

setup()

Prepare all the components of the motor when it is started.

wait(start=True, stop=True)

Wait for the motor busy state to change.

Parameters
  • start – (bool) Wait for the motor to start moving.

  • stop – (bool): Wait for the motor to stop moving.

Returns

(bool), True if successful

wait_start(timeout=2, poll=0.05)

Wait for motor to start moving :param timeout: Maximum time to wait before failing :param poll: Time step between checking motor state :return: (boolean), True if motor started successfully

wait_stop(target=None, timeout=120, poll=0.05)

Wait for motor to stop moving.

Parameters
  • target – Optional target to check

  • timeout – Maximum time to wait before failing

  • poll – Time step between checking motor state

Returns

(boolean), True if motor stopped successfully or if it is not moving.

Sub-classes

SimMotor(name[, pos, units, speed, limits, …])

Simulated Motor

Motor(name, *args, **kwargs)

Base Motor object for EPICS based motor records.

VMEMotor(name[, encoded])

CLS “vme” type motors.

CLSMotor(name[, encoded])

Ancient CLS type motor records.

APSMotor(name[, encoded])

APS type motor records.

PseudoMotor(name[, version])

CLS Pseudo Motor.

BraggEnergyMotor(name[, encoder, …])

VME Motor for Bragg based Energy

ResolutionMotor(energy, distance, detector_size)

Detector Resolution PseudoMotor

Multi-Channel Analyzers

Abstractions for configuring and acquiring data from a multichannel analyzers

class mxdc.devices.mca.BaseMCA(*args, **kwargs)

Base class for single and multi-element fluorescence MCA detector objects.

Signals

  • deadtime: float, dead time

Parameters
  • args – All arguments and key-worded arguments are passed to custom_setup() but before that, the following key-worded arguments are used if available.

  • kwargs – elements: (int) number of detector elements, default 1 channels: (int) number of channels per element, default 4096

acquire(duration=1.0)

Integrate the detector for the specified amount of time and return the raw data from all elements without any ROI manipulation. This method blocks.

Parameters

duration – (float), integrating time in seconds.

Returns

Array(float). An MxN array of counts from each channel of each element. Where M is the number of elements and N is the number of channels in the detector.

channel_to_energy(channel)

Convert a channel number to an energy value using the detectors calibration tables.

Parameters

channel – (int), channel number.

Returns

float. Energy in keV

configure(**kwargs)

Configure the detector for data acquisition.

Kwargs:
  • roi (tuple(int, int)): bounding channels enclosing region of interest.

  • energy (float): an energy value in keV around which to construct a region of interest. The ROI is calculated as a 150 eV window around the requested energy. If both roi and energy are given, energy takes precendence.

  • cooling (bool): cool down if available, ignore otherwise

  • nozzle (bool): move nozzle in if True and out if False, if nozzle is available, ignore otherwise

  • dark (bool): take dark current

count(duration)

Integrate the detector for the specified amount of time. This method blocks.

Parameters

duration – (float), integrating time in seconds.

Returns

float. The total integrated count from the region of interest of all detector elements. If individual counts for each element are desired, they can be obtained using get_roi_counts().

custom_setup(*args, **kwargs)

This is where all the custom setup for derived classes is performed. Must be overridden for derived classes. Care must be taken to make sure call signatures of derived classes are compatible if using explicitly named ordered arguments.

energy_to_channel(energy)

Convert a an energy to a channel number using the detectors calibration tables.

Parameters

energy – (float), Energy in keV.

Returns

(int), channel number

get_count_rates()

Obtain the input and output count rates for last performed data acquisition.

Returns

[(int, int)]. A list of tuples, one for each element. the first entry is the input count rate and the second is the output count rate. If the values are not available (-1, -1) is substituted

get_dark_counts()

Obtain the counts for the region of interest for each element of the detector for the dark data.

Returns

Array(float). The array contains as many elements as the number of elements.

get_roi(energy)

Get region of interest tuple for the given energy

Parameters

energy – Energy

get_roi_counts()

Obtain the counts for the region of interest for each element of the detector for the last performed data acquisition.

Returns

Array(float). The array contains as many elements as the number of elements.

stop()

Stop data acquisition.

wait()

Wait for the detector to start and then stop data acquisition.

Sub-classes

SimMCA(name[, energy, channels, nozzle])

Simulated MCA detector.

XFlashMCA(name[, channels, nozzle])

mcaRecord based single element fluorescence detector object.

VortexMCA(name[, channels, nozzle])

EPICS based 4-element Vortex ME4 detector object.

Mode Managers

Mode managers are devices which manage the beamline sample environment. A “mode” is a specific configuration of the sample environment suitable for a specific type of activity. Examples of modes include:

  • mount: Sample environment suitable for mounting/loading samples

  • center: Sample centering mode

  • collect: Data acquisition mode

  • align: Beam alignment mode

class mxdc.devices.manager.BaseManager(name='Beamline Modes')

Base Mode Manager. A device to manage beamline modes

Signals

  • mode: beamline mode

Properties

  • mode: beamline mode

class ModeType(value)

An enumeration.

align(wait=False)

Switch to Align mode

Parameters

wait – wait for switch to complete

center(wait=False)

Switch to Center mode

Parameters

wait – wait for switch to complete

collect(wait=False)

Switch to Collect mode

Parameters

wait – wait for switch to complete

get_mode()

Return the current mode

mount(wait=False)

Switch to Mount mode

Parameters

wait – wait for switch to complete

wait(*modes, start=True, stop=True, timeout=30)

Wait for the one of specified modes.

Parameters
  • modes – a list of Mode ENUMS or strings to wait for

  • start – (bool), Wait for the manager to become busy.

  • stop – (bool), Wait for the manager to become idle.

  • timeout – maximum time in seconds to wait before failing.

Returns

(bool), False if wait timed-out

Sub-classes

SimModeManager()

Simulated Mode Manager.

MD2Manager(root)

MD2 Based Mode Manager.

ModeManager(root)

CMCF BL Mode Mode Manager.

Miscellaneous Devices

class mxdc.devices.misc.BasePositioner

Base class for a simple positioning devices.

Signals

  • changed : Data is the new value of the devices.

get()

Get the current position

get_position()

Alias for the get() method.

set(value)

Set the value of the positioner

Parameters

value – new value

set_position(value)

Alias for the set() method.

class mxdc.devices.misc.Positioner(name, fbk_name=None, scale=100, units='', wait_time=0)

Simple EPICS based positioning devices.

Parameters

name – process variable name

Kwargs:
  • fbk_name (str): optional Name of PV for getting current value. If not provided, the same PV will be used to both set and get.

  • scale (float): A percentage to scale the set and get values by.

  • units (str): The units of the value.

get()

Get the current position

set(pos, wait=False)

Set the value of the positioner

Parameters

value – new value

class mxdc.devices.misc.ChoicePositioner(pv, choices=(), units='')

An Enumerated EPICS choice positioner

Parameters

pv – name of process variable

kwargs:
  • choices: tuple of values to translate to

  • units: device units

get()

Get the current position

set(value, wait=False)

Set the value of the positioner

Parameters

value – new value

class mxdc.devices.misc.PositionerMotor(positioner)

Adapts a positioner so that it behaves like a Motor (ie, provides the IMotor interface.

Parameters

positioner – Positioner device

move_by(val, wait=False, force=False)

Similar to move_to(), except request the motor to move by a relative amount.

Parameters
  • value – Relative amount to move position by

  • wait – Whether to block until move is completed or not

  • force – Force move even if already at current position

move_to(pos, wait=False, force=False)

Move to an absolute position.

Parameters
  • pos – Target position

  • wait – Block until move is done, default is non-blocking

  • force – Force move even if already at current position

wait(**kwargs)

Wait for the motor busy state to change.

Parameters
  • start – (bool) Wait for the motor to start moving.

  • stop – (bool): Wait for the motor to stop moving.

Returns

(bool), True if successful

SimPositioner(name[, pos, units, active, …])

Simulated positioner

SimChoicePositioner(name, value[, choices, …])

Simulated choice positioner

Attenuator(bitname, energy)

A positioner for EPICS XIA attenuator boxes

Attenuator2(bitname, energy)

Second generation XIA attenuator EPICS device

SimEnclosures(name)

Simulated Enclusures

class mxdc.devices.misc.OnOffToggle(pv_name, values=(1, 0))

A Device that can be toggled on/off.

Signals

  • changed: (bool,) state of the device

Parameters

pv_name – process variable name

kwargs:
  • values: tuple of values representing (on value, off value) for the PV.

is_on()

Check if the light is on or off

off()

Alias for set_off()

on()

Alias for set_on()

set_off()

Turn off the device

set_on()

Turn on the device

class mxdc.devices.misc.SampleLight(set_name, fbk_name, onoff_name, scale=100, units='')

Illumination controller device. This device is a Positioner that can in addition be turned On and Off.

Parameters
  • set_name – name of PV for setting illumination level

  • fbk_name – name of PV for getting the illumination level

  • onoff_name – name of PV for toggling the light on or off

kwargs:
  • scale: scale value for illumination level

  • units: units of the device

is_on()

Check if the light is on or off

off()

Alias for set_off()

on()

Alias for set_on()

set_off()

Turn off the device

set_on()

Turn on the device

class mxdc.devices.misc.DiskSpaceMonitor(descr, path, warn=0.05, critical=0.025, freq=10)

A device which periodically monitors a given path for available space.

Parameters
  • descr – Description

  • path – Path to monitor

  • warn – Warn if Fraction of available space goes below

  • critical – Raise alarm if Fraction of available space goes below

  • freq – Frequency in minutes to check space

check_space()

Check disk space and emit health signals accordingly

humanize(size)

Convert disk space to human friendly units :param size: disk size :return: human friendly size string

class mxdc.devices.misc.Enclosures(**kwargs)

A device for monitoring beamline enclosures

Params kwargs

name, pv_name pairs each representing one beamline enclosure to monitor

get_messages()

Generate and return messages indicating the status of the enclosures

class mxdc.devices.misc.CamScaleFromZoom(zoom, width=1360.0)

A positioner for converting camera zoom values to pixel size for the sample microscope video.

Parameters

zoom – zoom device

kwargs:
  • width: width of camera video.

get()

Get the current position

set(value)

Set the value of the positioner

Parameters

value – new value

Shutters

class mxdc.devices.shutter.BaseShutter

Base class for all shutters.

Signals

  • changed: (bool,) State of shutter

close(wait=False)

Close the shutter if open

Parameters

wait – bool, if True, block until shutter is fully closed

is_open()

Convenience function to check for opened state

open(wait=False)

Open the shutter if closed

Parameters

wait – bool, if True, block until shutter is fully open

wait(state=True, timeout=5.0)

Wait for the shutter to reach a given state. Subclasses need not re-implement this method.

Parameters
  • state – bool, True = ‘open’, False = ‘close’

  • timeout – timeout duration

Sub-classes

SimShutter(name)

Simulated Shutter

EPICSShutter(open_name, close_name, state_name)

EPICS Shutter requiring three PVs (close, open, state).

StateLessShutter(open_name, close_name)

EPICS shutter which has not state

ToggleShutter(name[, reversed])

A Toggle shutter controlled by a single process variable

ShutterGroup(*shutters[, close_last])

Meta Shutter controlling a sequence of shutters

Shutter(root[, name])

CLS EPICS Shutter

Stages

class mxdc.devices.stages.BaseSampleStage

Base class for sample alignment stages

Signals

  • changed: (object,) stage information

get_omega()

Get the angle position

screen_to_xyz(x, y, z)

Convert screen coordiantes to x, y, z

Parameters
  • x – x-position

  • y – y-position

  • z – z-position

Returns

(x, y, z) screen coordinates

wait(start=False, stop=True)

Wait for the busy state to change.

Kwargs:
  • start (bool): Wait for the motor to start moving.

  • stop (bool): Wait for the motor to stop moving.

xvw_to_screen(x, v, w)

Convert 3D horizontal, vertical, omega coordinates to screen coordinates

Parameters
  • x – horizontal position

  • v – vertical position

  • w – omega angle position

Returns

(x, y, z) screen coordinates

xvw_to_xyz(x, v, w)

Convert 3D horizontal, vertical, omega coordinates to x, y, z coordinates

Parameters
  • x – horizontal position

  • v – vertical position

  • w – omega angle position

Returns

(x, y, z)

xyz_to_screen(x, y, z)

Convert 3D horizontal, x, y, z to screen coordinates

Parameters
  • x – x-position

  • y – y-position

  • z – z-position

Returns

(x, y, z) screen coordinates

xyz_to_xvw(x, y, z)

Convert 3D x, y, z coordinates to horizontal, vertical and angle coordinates

Parameters
  • x – x-position

  • y – y-position

  • z – z-position

Returns

(x, v, w) ie (horizontal, vertical, omega angle)

Sub-classes

SampleStage(x, y1, y2, omega[, name, …])

Sample stage based based on x, y1, y2 and omega motors.

Storage Ring

class mxdc.devices.synchrotron.BaseStorageRing

Base class for storage ring devices

Signals

  • ready: arg_types=(bool,), beam available state

Properties

  • current: float, stored current

  • mode: int, operational mode

  • state: int, storage ring state

  • message: str, storage ring message

beam_available()

Check beam availability

wait_for_beam(timeout=60)

Wait for beam to become available

Parameters

timeout – timeout period

Sub-classes

StorageRing(current_pv, mode_pv, state_pv)

EPICS Storage Ring Device

Video

class mxdc.devices.video.VideoSrc(name='Basic Camera', maxfps=5.0)

Base class for all Video Sources. Maintains a list of listenners (sinks) and updates each one when the video frame changes.

Parameters
  • name – Camera Name (str)

  • maxfps – Max frames per second (float)

add_sink(sink)

Add a sink to the Camera

Parameters

sinkmxdc.interface.IVideoSink provider

cleanup()

Clean up before shutdown

configure(**kwargs)

Configure the camera. Keyword arguments are device dependent.

del_sink(sink)

Remove a video sink.

Parameters

sinkmxdc.interface.IVideoSink provider

get_frame()

Obtain the most recent video frame.

Returns

A PIL Image object.

start()

Start producing video frames.

stop()

Stop producing video frames.

Sub-classes

SimCamera([name, size])

Simulated Camera

SimPTZCamera()

Simulated PTZ Camera

MJPGCamera(url[, size, name])

MJPG Camera

JPGCamera(url[, size, name])

JPG Camera

REDISCamera(server, mac[, size, name])

REDIS Camera

AxisCamera(hostname[, idx, name])

Axis JPG Camera

AxisPTZCamera(hostname[, idx, name])

Axis PTZ Camera