areaDetector LightField driver

January 30, 2018

Mark Rivers

University of Chicago

Table of Contents

Introduction

This is an EPICS areaDetector driver for recent Princeton Instruments detectors including the ProEM, PIXIS, PI-MAX3, PI-MAX4, PyLoN, and Quad-RO. It also supports the Acton Series spectrographs.

The interface to the detector is via the Microsoft Common Language Runtime (CLR) interface to the LightField program that Princeton Instruments sells. The areaDetector driver effectively "drives" LightField through the CLR interface, performing most of the same operations that can be performed using the LightField GUI. The advantage of this communication mechanism is that the user can continue to use LightField for viewing images and for configuration operations. LightField is automatically started when the areaDetector software is started.

Because EPICS and the LightField GUI can control many of the same parameters the user must be aware of the interactions between the two control systems. The basic rule is that the value of a parameter will be determined by whichever control system last wrote to that parameter. The LightField widget will display the current value of a parameter no matter how it was last changed. EPICS will correctly display the current value of the parameter in the "readback" record, which typically ends in "_RBV", no matter how the value was last changed. However the EPICS output record does not currently update if the value is changed in LightField. This may change in a future version of asyn device support.

This driver inherits from ADDriver. It implements many of the parameters asynNDArrayDriver.h and in ADArrayDriver.h. It also implements a number of parameters that are specific to the LightField application.The LightField class documentation describes this class in detail.

Implementation of standard driver parameters

The following table describes how the LightField driver implements some of the standard driver parameters. Note that there are 4 possible levels of nested acquisition looping when using the LightField driver. From the innermost to outermost loop these are as follows:

  1. LFNumAccumulations ($(P)$(R)NumAccumularions). This controls the number of accumulations per image. Accumulations are acquired in hardware on the detector before it is read out.
  2. ADNumExposures ($(P)$(R)NumExposures). This controls the number of images that are summed together by LightField into a single image.
  3. ADNumImages ($(P)$(R)NumImages). This controls the number of images per acquisition. This is also called AcquisitionFramesToStore in LightField's terminology. These images will all be acquired into a single 3-D array, and saved to a single SPE file in LightField.
  4. LFNumAcquisitions ($(P)$(R)NumAcquisitions). This controls the number of times that the driver will repeat an acquisition sequence. This is has no equivalent in LightField, it is handled entirely by the areaDetector driver. It can be used to acquire multiple data sets, where each is controlled by the above parameters. NOTE: NumAcquisitions is not yet implemented, but is planned in a future release.
Implementation of Parameters in asynNDArrayDriver.h and ADDriver.h, and EPICS Record Definitions in ADBase.template and NDFile.template
Parameter index variable EPICS record name Description
ADImageMode $(P)$(R)ImageMode The driver redefines the choices for the ADImageMode parameter (record $(P)$(R)ImageMode) from ADDriver.h. The choices for the LightField are:
  • Normal: This is the same as pressing the Acquire button in LightField. It may collect more than 1 accumulation per image if numAccumulations>1, more than 1 exposure per image if NumExposures>1, more than 1 image per acquisition if NumImages>1, and more than 1 aquisition if NumAcquisitions>1.
  • Preview: This is the same as pressing the Preview button in LightField. It causes acquisition to proceed as quickly as possible. It does not save the data.
  • Background: This will cause the driver to acquire a background image to be used when background subtraction is enabled.
ADNumExposures $(P)$(R)NumExposures Controls the number of exposures that LightField will sum into a single image.
ADNumImages $(P)$(R)NumImages Controls the number of images to acquire into a single 3-D data set.
ADGain $(P)$(R)Gain The precision of the $(P)$(R)Gain record is changed to 0 because the gain in LightField is an integer. Allowed values are detector dependent, but 1 and 2 are typically supported.

LightField specific parameters

The LightField driver implements the following parameters in addition to those in asynNDArrayDriver.h and ADDriver.h.

Parameter Definitions in LightField.cpp and EPICS Record Definitions in LightField.template
Parameter index variable asyn interface Access Description drvInfo string EPICS record name EPICS record type
Acquisition parameters
LFNumAccumulations asynInt32 r/w The number of on-chip accumulations to perform per image. LF_NUM_ACCUMULATIONS $(P)$(R)NumAccumulations
$(P)$(R)NumAccumulations_RBV
longout
longin
LFNumAcquisitions asynInt32 r/w The number of acquisitions to perform when acquisition is started. This controls the number of iterations in the outermost acquisition loop explained above. NOTE: This is not yet implemented, it is planned for a future release. LF_NUM_ACQUISITIONS $(P)$(R)NumAcquisitions
$(P)$(R)NumAcquisitions_RBV
longout
longin
LFNumAcquisitionsCounter asynInt32 r/o The number of acquisitions performed so far. LF_NUM_ACQUISITIONS_COUNTER $(P)$(R)NumAcquisitionsCounter_RBV longin
LFGain asynInt32 r/w The camera gain. This parameter is used instead of the base class ADGain parameter so that it can be displayed as a menu as LightField does. LF_GAIN $(P)$(R)LFGain
$(P)$(R)LFGain_RBV
mbbo
mbbi
LFShutterMode asynInt32 r/w The shutter operating mode for shutters controlled by LightField. Allowed values are:
  • Normal: The detector shutter will be opened and closed normally for each exposure.
  • Always closed: The shutter will be kept closed. Useful for taking a dark current image.
  • Always open: The shutter will be kept open. Useful if the light source is a strobe so the shutter is not needed.
  • Open before trigger: The detector shutter will be opened before the trigger.
LF_SHUTTER_MODE $(P)$(R)LFShutterMode
$(P)$(R)LFShutterMode_RBV
mbbo
mbbi
Experiment parameters
LFExperimentName asynInt32 r/w Selects the LightField experiment, which is a set of experimental conditions including the selected camera, etc. The record choices are constructed at run-time based on the experiment files currently available. LF_EXPERIMENT_NAME $(P)$(R)LFExperimentName
$(P)$(R)LFExperimentName_RBV
mbbo
mbbi
LFUpdateExperiments asynInt32 r/w Updates the choices in the LFExperimentName records. This is only needed if a new experiment is created after the EPICS IOC is started. LF_UPDATE_EXPERIMENTS $(P)$(R)LFUpdateExperiments bo
Spectrometer parameters
LFGrating asynInt32 r/w Selects the spectrometer grating. The record choices are constructed at run-time based on the gratings actually available. LF_GRATING $(P)$(R)LFGrating
$(P)$(R)LFGrating_RBV
mbbo
mbbi
LFGratingWavelength asynFloat64 r/w Selects the center wavelength of the spectrometer. LF_GRATING_WAVELENGTH $(P)$(R)LFGratingWL
$(P)$(R)LFGratingWL_RBV
ao
ai
LFSAGStartingWavelength asynFloat64 r/w Selects the starting wavelength of the spectrometer for Step And Glue. LF_SAG_STARTING_WAVELENGTH $(P)$(R)LFSAGStartingWL
$(P)$(R)LFSAGStartingWL_RBV
ao
ai
LFSAGEndingWavelength asynFloat64 r/w Selects the ending wavelength of the spectrometer for Step And Glue. LF_SAG_ENDING_WAVELENGTH $(P)$(R)LFSAGEndingWL
$(P)$(R)LFSAGEndingWL_RBV
ao
ai
LFSAGEnable asynInt32 r/w Enables and disables Step and Glue. LF_SAG_ENABLE $(P)$(R)LFSAGEnable
$(P)$(R)LFSAGEnable_RBV
bo
bi
LFEntranceWidth asynInt32 r/w Selects the entrance width of the side port on the spectrometer in microns. LF_ENTRANCE_SIDE_WIDTH $(P)$(R)LFEntranceWidth
$(P)$(R)LFEntranceWidth_RBV
longout
longin
LFEntrancePort asynInt32 r/w Selects the entrance port of the spectrometer. Choices are:
  • Side
  • Front
LF_ENTRANCE_SELECTED $(P)$(R)LFEntrancePort
$(P)$(R)LFEntrancePort_RBV
mbbo
mbbi
LFExitPort asynInt32 r/w Selects the exit port of the spectrometer. Choices are:
  • Side
  • Front
LF_EXIT_SELECTED $(P)$(R)LFExitPort
$(P)$(R)LFExitPort_RBV
mbbo
mbbi
File name parameters. These are in addition to the normal parameters from NDFile.template.
LFFilePath asynOctet r/o The actual file path for saving data. LF_FILE_PATH $(P)$(R)LFFilePath_RBV waveform
LFFileName asynOctet r/o The actual file name for saving data. LF_FILE_NAME $(P)$(R)LFFileName_RBV waveform
LFBackgroundPath asynOctet r/w The file path to use for saving background data. LF_BACKGROUND_PATH $(P)$(R)LFBackgroundPath
$(P)$(R)LFBackgroundPath_RBV
waveform
waveform
LFBackgroundPathExists asynInt32 r/o Flag to indicate if the file path to use for saving background data exists. If it does not exist it will be created if the $(P)$(R)CreateDirectory PV is set appropriately. LF_BACKGROUND_PATH_EXISTS $(P)$(R)LFBackgroundPathExists_RBV bi
LFBackgroundFile asynOctet r/w The file name to use for saving background data. LF_BACKGROUND_FILE $(P)$(R)LFBackgroundFile
$(P)$(R)LFBackgroundFile_RBV
waveform
waveform
LFBackgroundFullFile asynOctet r/o The actual full file name for saving background data. LF_BACKGROUND_FULL_FILE $(P)$(R)LFBackgroundFullFile_RBV waveform
LFBackgroundEnable asynInt32 r/w Enable background correction. LF_BACKGROUND_ENABLE $(P)$(R)LFBackgroundEnable
$(P)$(R)LFBackgroundEnable_RBV
bo
bi
Image intensifier and timing parameters.
LFIntensifierEnable asynInt32 r/w Enable image intensifier. LF_INTENSIFIER_ENABLE $(P)$(R)LFIntensifierEnable
$(P)$(R)LFIntensifierEnable_RBV
bo
bi
LFIntensifierGain asynInt32 r/w Image intensifier gain. LF_INTENSIFIER_GAIN $(P)$(R)LFIntensifierGain
$(P)$(R)LFIntensifierGain_RBV
ao
ai
LFGatingMode asynInt32 r/w Image intensifier gating mode. Choices are:
  • Repetitive
  • Sequential
LF_GATING_MODE $(P)$(R)LFGatingMode
$(P)$(R)LFGatingMode_RBV
mbbo
mbbi
LFTriggerFrequency asynFloat64 r/w Selects the intensifier trigger frequency. LF_TRIGGER_FREQUENCY $(P)$(R)LFTriggerFrequency
$(P)$(R)LFTriggerFrequency_RBV
ao
ai
LFSyncMasterEnable asynInt32 r/w Enable sync master. LF_SYNCMASTER_ENABLE $(P)$(R)LFSyncMasterEnable
$(P)$(R)LFSyncMasterEnable_RBV
bo
bi
LFSyncMaster2Delay asynFloat64 r/w Selects the sync master 2 delay. LF_SYNCMASTER2_DELAY $(P)$(R)LFSyncMaster2Delay
$(P)$(R)LFSyncMaster2Delay_RBV
ao
ai
LFRepGateWidth asynFloat64 r/w Selects the repetitive gate width. LF_REP_GATE_WIDTH $(P)$(R)LFRepGateWidth
$(P)$(R)LFRepGateWidth_RBV
ao
ai
LFRepGateDelay asynFloat64 r/w Selects the repetitive gate delay. LF_REP_GATE_DELAY $(P)$(R)LFRepGateDelay
$(P)$(R)LFRepGateDelay_RBV
ao
ai
LFSeqStartGateWidth asynFloat64 r/w Selects the sequential start gate width. LF_SEQ_START_GATE_WIDTH $(P)$(R)LFSeqStartGateWidth
$(P)$(R)LFSeqStartGateWidth_RBV
ao
ai
LFSeqStartGateDelay asynFloat64 r/w Selects the sequential start gate delay. LF_SEQ_START_GATE_DELAY $(P)$(R)LFSeqStartGateDelay
$(P)$(R)LFSeqStartGateDelay_RBV
ao
ai
LFSeqEndGateWidth asynFloat64 r/w Selects the sequential end gate width. LF_SEQ_END_GATE_WIDTH $(P)$(R)LFSeqEndGateWidth
$(P)$(R)LFSeqEndGateWidth_RBV
ao
ai
LFSeqEndGateDelay asynFloat64 r/w Selects the sequential end gate delay. LF_SEQ_END_GATE_DELAY $(P)$(R)LFSeqEndGateDelay
$(P)$(R)LFSeqEndGateDelay_RBV
ao
ai
LFAuxWidth asynFloat64 r/w Selects the auxiliary width. LF_AUX_WIDTH $(P)$(R)LFAuxWidth
$(P)$(R)LFAuxWidth_RBV
ao
ai
LFAuxDelay asynFloat64 r/w Selects the auxiliary delay. LF_AUX_WIDTH $(P)$(R)LFAuxDelay
$(P)$(R)LFAuxDelay_RBV
ao
ai
Miscellaneous parameters.
LFBackgroundEnable asynInt32 r/w Enable background correction. LF_BACKGROUND_ENABLE $(P)$(R)LFBackgroundEnable
$(P)$(R)LFBackgroundEnable_RBV
bo
bi
LFReadyToRun asynInt32 r/o Flag indicating if LighField is ready to collect data. LF_READY_TO_RUN $(P)$(R)ReadyToRun bi

Configuration

The LightField driver is created with the LightFieldConfig command, either from C/C++ or from the EPICS IOC shell.

int LightFieldConfig(const char *portName, const char *experimentName,
                int maxBuffers, size_t maxMemory,
                int priority, int stackSize)
  

For details on the meaning of the parameters to this function refer to the detailed documentation on the LightFieldConfig function in the LightField.cpp documentation and in the documentation for the constructor for the LightField class.

There an example IOC boot directory and startup script (iocBoot/iocLightField/st.cmd) provided with areaDetector.

MEDM screens

The following show the MEDM screens that are used to control the LightField detector. Note that the general purpose screen ADBase.adl can be used, but it exposes a few controls that are not applicable to the LightField, and lacks some fields that are important for the LightField.

LightField.adl is the main screen used to control the LightField driver.

LightField.adl

LightField.png

LightFieldFile.adl is the screen used to control LighField file I/O.

LightFieldFile.adl

LightFieldFile.png

LighField is program that the LightField driver is controlling via Microsoft Common Language Runtime.

LighField program from Priceton Instruments

LightFieldApplication.png

Restrictions

The following are some current restrictions of the LightField driver: