This is an EPICS areaDetector driver for the Pixirad detectors from Pixirad.
The Pixirad detector is a pixel array detector with a cadmium teluride (CdTe) sensor, so it has high efficiency at high energy. There are 2 versions of the ASIC, the older PII, and the newer PIII. The PII base module is 476 x 512 pixels, while the PIII is 402 x 512 pixels. The detector is available with a single module (Pixirad-1), 2 modules (Pixirad-2), and 8 modules (Pixirad-8).
The detector does photon counting of all photons above a programmable energy threshold. The detector hardware has 2 energy thresholds and two counters per pixel, so it can collect 2 energy images simultaneously. The PII firmware supports 4 thresholds, by first collecting 2 energies, and then collecting another image with 2 additional energies. The detector can be operated in 1, 2, or 4 color mode. In addition it supports deadtime-free (DTF) counting modes where one image is being collected while the other is being read out. Both 1 and 2 color DTF modes are supported. The NDArrays produced by this driver are unsigned 16-bit integers. They have dimensions [XSIZE, YSIZE] for 1 color images, [XSIZE, YSIZE, 2] for 2 color images, and [XSIZE, YSIZE, 4] for 4 color images. XSIZE=476 for PII and 402 for PIII. YSIZE=NumModules*512 for both the PII and PIII.
The command interface to the detector is via a TCP/IP socket interface to the detector on port 2222.
The driver receives status information from the detector via UDP broadcast messages on port 2224. The status includes temperatures, humidity and high voltage.
The driver receives image data from the detector via UDP broadcast messages on port 2223 for the Pixirad-1, and port 9999 for the Pixirad-2 and Pixirad-8. This data is received by a "UDP listener thread" in the driver, which passes the UDP buffers as they are received via a pointer on an epicsMessageQueue to a "data unpacking thread". This second thread unscrambles the UDP buffers, converts them to areaDetector NDArrays, and does the callbacks to registered plugins. The size of the epicsMessageQueue is controlled by a parameter passed to the driver constructor, and is set to 1500 in the example IOC. This provides a buffer in case the UDP listener thread is receiving images faster than the data unpacking thread can process them.
The detector can in principle be on a public network where it will receive its IP address from a DHCP server. In practice the current detector firmware does not work correctly in this configuration, because the UDP messages do not use the correct network addresses. This means that the detector must be placed on a private network with no DHCP server. It will always have the network address 192.168.0.1. This also means that the computer running the areaDetector driver must have 2 network cards, with the one connected to the detector having a host address on the 192.168.0 subnet.
This driver inherits from ADDriver. It implements many of the parameters in asynNDArrayDriver.h and in ADArrayDriver.h. It also implements a number of parameters that are specific to the Pixirad detectors. The pixirad class documentation describes this class in detail.
The following table describes how the Pixirad driver implements some of the standard driver parameters.
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 |
---|---|---|
ADFrameType | $(P)$(R)FrameType |
The choices for the Pixirad are:
1 color arrays are 2-D with dimensions [SIZEX, SIZEY]. 2 color arrays are 3-D with dimensions [SIZEX, SIZEY, 2]. 4 color arrays are 3-D with dimensions[SIZEX, SIZEY, 4]. |
ADTriggerMode | $(P)$(R)TriggerMode |
The choices for the Pixirad are:
|
ADTemperature | $(P)$(R)Temperature | The setpoint for the cold temperature of the detector. |
ADTemperatureActual | $(P)$(R)TemperatureActual | The readback of the temperature on the cold side of the Peltier cooler. |
ADNumImages | $(P)$(R)NumImages | Controls the number of images to acquire. |
ADAcquirePeriod | $(P)$(R)AcquirePeriod | Controls the period between images. If this is greater than the acquisition time then the detector will wait until the period has elapsed before collection the next image. |
When collecting 2 or 4 color images it is useful to use NDPluginROI to select a single color. This can be done by defining an ROI with X and Y set to the full detector size (AutoSizeX=Yes, AutoSizeY=Yes) and Z set to AutoSizeX=No and SizeZ=1. MinZ can then be used to select a single color (0=color 1, 1=color2, etc.). If the NDStdArrays plugin is set to get its data from this ROI plugin then the ImageJ display client will display the selected color image.
The Pixirad driver implements the following parameters in addition to those in asynNDArrayDriver.h
and ADDriver.h. Note that to reduce the width of this table the parameter index
variable names have been split into 2 lines, but these are just a single name, for
example AutoCalibrate
.
Parameter Definitions in pixirad.cpp and EPICS Record Definitions in pixirad.template | ||||||
Parameter index variable | asyn interface | Access | Description | drvInfo string | EPICS record name | EPICS record type |
---|---|---|---|---|---|---|
System information | ||||||
Pixirad SystemInfo |
asynOctet | r/o | A string containing information about the detector, read directly from the detector. | SYSTEM_INFO | $(P)$(R)SystemInfo | waveform |
Counting mode (PIII only) | ||||||
Pixirad CountMode |
asynInt32 | r/w |
Selects the counting mode. Choices are:
0: Normal 1: NPI This stands for Neighbor Pixel Inhibit. It prevents counting a photon more than once when charge-sharing occurs. 2: NPISUM This stands for Neighbor Pixel Inhibit with Summation. It sums the charge from adjacent pixels when charge-sharing occurs. |
COUNT_MODE |
$(P)$(R)CountMode
$(P)$(R)CountMode_RBV |
mbbo
mbbi |
Cooling parameters | ||||||
Pixirad CoolingState |
asynInt32 | r/w | The state of the Peltier cooler. Choices are "Off" (0) and "On" (1). | COOLING_STATE |
$(P)$(R)CoolingState $(P)$(R)Cooling_RBV |
bo bi |
Pixirad HotTemperature |
asynFloat64 | r/o | The readback of the temperature (C) on the hot side of the Peltier cooler. | HOT_TEMPERATURE | $(P)$(R)HotTemperature_RBV | ai |
Pixirad BoxTemperature |
asynFloat64 | r/o | The readback of the ambient temperature (C) in the detector box. | BOX_TEMPERATURE | $(P)$(R)BoxTemperature_RBV | ai |
Pixirad BoxHumidity |
asynFloat64 | r/o | The readback of the ambient relative humidity (%) in the detector box. | BOX_HUMIDITY | $(P)$(R)BoxHumidity_RBV | ai |
Pixirad DewPoint |
asynFloat64 | r/o | The calculated dew point (C) based on the BoxHumidity. | DEW_POINT | $(P)$(R)DewPoint_RBV | ai |
Pixirad PeltierPower |
asynFloat64 | r/o | The power level of the Peltier cooler (%). | PELTIER_POWER | $(P)$(R)PeltierPower_RBV | ai |
Pixirad CoolingStatus |
asynInt32 | r/o |
The status of the cooling system. Values are: 0 - "OK" 1 - "Dew Pt Warning" This means that the cold temperature is within 3 degree of the dew point. 2 - "Dew Pt Error" This means that the cold temperature is less than or equal to the dew point. 3 - "T Hot Warning" This means that the hot temperature is greater than 40 C. 4 - "T Hot Error" This means that the hot temperature is greater than 50 C. 5 - "T Cold Warning" This means that the cold temperature is greater than 30 C. 6 - "T Cold Error" This means that the cold temperature is greater than 40 C. If the CoolingStatus_RBV is any of the Error states then the driver will automatically turn off the Peltier cooler. |
COOLING_STATUS | $(P)$(R)CoolingStatus_RBV | mbbi |
High voltage parameters | ||||||
Pixirad HVMode |
asynInt32 | r/w |
High voltage mode. Choices are: 0 - "Manual" 1 - "Auto" In Manual mode the high voltage is turned off and on with the HVState record. In Auto mode if HVState is Off then the high voltage will be automatically turned on when an acquisition is started and automatically turn off when the acquisition is complete. This can improve the image quality, because the detector is subject to charge trapping when used with high x-ray fluxes, and periodically turning off the high voltage helps to clear the trapped charge. |
HV_MODE |
$(P)$(R)HVMode
$(P)$(R)HVMode_RBV |
bo
bi |
Pixirad HVState |
asynInt32 | r/w |
High voltage state. Choices are: 0 - "Off" 1 - "On" This record turns the high voltage off and on. If HVMode is Auto then the high voltage will be turned on during an acquisition even if HVState is off. |
HV_STATE |
$(P)$(R)HVState
$(P)$(R)HVState_RBV |
bo
bi |
Pixirad HVValue |
asynFloat64 | r/w | The high voltage value that will be applied to the detector when HVState=On or when HVMode=Auto and an acquisition is in progress. The allowed range is 0 to 400 volts. | HV_VALUE |
$(P)$(R)HVValue
$(P)$(R)HVValue_RBV |
ao
ai |
Pixirad HVActual |
asynFloat64 | r/o | The actual high voltage currently being applied to the detector. | HV_ACTUAL | $(P)$(R)HVActual_RBV | ai |
Pixirad HVCurrent |
asynFloat64 | r/o | The actual high voltage current. | HV_CURRENT | $(P)$(R)HVCurrent_RBV | ai |
Threshold parameters | ||||||
Pixirad ThresholdN (N=1-4) |
asynFloat64 | r/w | Requested threshold energy in keV. There are 4 energy thresholds. The threshold energies are controlled by a single high-resolution register (VThMax) with values from 1500 to 2200, and 4 low-resoltion registers with values from 0 to 31. The driver attempts to set Threshold1 as closely as possible to the requested value by changing both VThMax and the low-resolution register. Thresholds 2-4 are then set as closely as possible to their requested values using only the low-resolution registers. | THRESHOLDN (N=1-4) |
$(P)$(R)ThresholdN (N=1-4) $(P)$(R)ThresholdN_RBV (N=1-4) |
ao
ai |
Pixirad ThresholdActualN (N=1-4) |
asynFloat64 | r/o | Actual threshold energy in keV. This will be as close as possible to the requested value, subject to the constraints and algorithm explained above. | THRESHOLD_ACTUALN (N=1-4) | $(P)$(R)ThresholdActualN_RBV (N=1-4) | ai |
Pixirad HitThreshold |
asynFloat64 | r/w | This is only used on the PIII ASIC. It sets the threshold in keV where the PIII will consider a photon "hit" to have ocurred. This threshold is mainly intended for use when CountMode=NPI or NPISUM. However, even when CountMode=Normal it must always be set to a value less than Threshold 1. | HIT_THRESHOLD |
$(P)$(R)HitThreshold $(P)$(R)HitThreshold_RBV |
ao
ai |
Pixirad HitThresholdActual |
asynFloat64 | r/o | Actual hit threshold energy in keV. This will be as close as possible to the requested value, subject to the constraints and algorithm explained above. | HIT_THRESHOLD_ACTUAL | $(P)$(R)HitThresholdActual_RBV | ai |
External sync parameters | ||||||
Pixirad SyncInPolarity |
asynInt32 | r/w |
Polarity of the Sync In signal. Choices are:
0 - "Pos." 1 - "Neg." |
SYNC_IN_POLARITY |
$(P)$(R)SyncInPolarity $(P)$(R)SyncInPolarity_RBV |
bo
bi |
Pixirad SyncOutPolarity |
asynInt32 | r/w |
Polarity of the Sync Out signal. Choices are:
0 - "Pos." 1 - "Neg." |
SYNC_OUT_POLARITY |
$(P)$(R)SyncOutPolarity $(P)$(R)SyncOutPolarity_RBV |
bo
bi |
Pixirad SyncOutFunction |
asynInt32 | r/w |
Function of the Sync Out signal. Choices are:
0 - "Shutter" The Sync Out signal is high while the detector is collecting. 1 - "Read done" The Sync Out signal outputs a pulse when readout is complete. 2 - "Read" The Sync Out signal is high while the detector is reading out. |
SYNC_OUT_FUNCTION |
$(P)$(R)SyncOutFunction $(P)$(R)SyncOutFunction_RBV |
mbbo
mbbi |
Data collection status parameters | ||||||
Pixirad ColorsCollected |
asynInt32 | r/o | The number of colors collected so far for the current image. | COLORS_COLLECTED | $(P)$(R)ColorsCollected_RBV | longin |
Pixirad UDPBuffersRead |
asynInt32 | r/o | The number of UDP buffers (images) read by the UDP listener thread for the current acquisition. | UDP_BUFFERS_READ | $(P)$(R)UDPBuffersRead_RBV | longin |
Pixirad UDPBuffersMax |
asynInt32 | r/o | The maximum number of UDP buffers (images) for UDP listener thread. This is set at startup. | UDP_BUFFERS_MAX | $(P)$(R)UDPBuffersMax_RBV | longin |
Pixirad UDPBuffersFree |
asynInt32 | r/o | The number of free UDP buffers (images). | UDP_BUFFERS_FREE | $(P)$(R)UDPBuffersFree_RBV | longin |
Pixirad UDPSpeed |
asynFloat64 | r/o | The speed with which the last UDP buffer was received (MB/s). | UDP_SPEED | $(P)$(R)UDPSpeed_RBV | ai |
Calibration and reset parameters | ||||||
Pixirad AutoCalibrate |
asynInt32 | r/w | Sends a command to the detector to perform an autocalibration. The detector makes adjustments to achieve uniform pixel response. This operation must be performed at least once after the detector is power-cycled, and whenever necessary as the chip temperature and/or supply voltages may drift with time and environmental conditions. If autocalibration has not been performed then there will be many "hot" (non-zero) pixels in the image with no x-rays. | AUTO_CALIBRATE |
$(P)$(R)AutoCalibrate $(P)$(R)AutoCalibrate_RBV |
bo bi |
Pixirad SystemReset |
asynInt32 | r/w | Writing 1 to this record sends a command to reset detector to its initial state. This causes the sockets to disconnect, and it takes about 30 seconds for the system to recover. Once it recovers the driver then sends commands to set all of the programmable parameters (thresholds, cooling, high voltage, etc.) to the current values in the EPICS output records. When the system is available again SystemReset record will go back to 0. | SYSTEM_RESET |
$(P)$(R)SystemReset $(P)$(R)SystemReset_RBV |
bo bi |
The Pixirad driver does not support the following standard driver parameters:
The Pixirad driver is created with the pixiradConfig command, either from C/C++ or from the EPICS IOC shell.
int pixiradConfig(const char *portName, const char *commandPortName, int dataPortNumber, int statusPortNumber, int maxDataPortBuffers, int maxSizeX, int maxSizeY, 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 pixiradConfig function in the pixirad.cpp documentation and in the documentation for the constructor for the pixirad class.
There an example IOC boot directory and startup script (iocBoot/iocPixirad/st.cmd) provided with areaDetector.
The following shows the MEDM screen that are used to control the Pixirad detector. Note that the general purpose screen ADBase.adl can be used, but it exposes many controls that are not applicable to the Pixirad, and lacks some fields that are important for the Pixirad.
pixirad.adl
is the main screen used to control the Pixirad driver.
The following measurements were done to demonstrate the performance that can be obtained with the areaDetector Pixirad driver. The timings were done by measuring the frequency of the Sync Out signal on an oscilloscope. The SyncOutFunction was "Shutter" and 1000 frames were collected.
FrameType | AcquireTime | Frames/sec |
---|---|---|
1 color low | 0.02 | 35.7 |
1 color low | 0.01 | 57.4 |
1 color low | 0.01 | 57.4 |
1 color low | 0.005 | 83.3 |
1 color low | 0.001 | 125.0 |
1 color DTF | 0.02 | 47.3 |
1 color DTF | 0.01 | 93.8 |
1 color DTF | 0.005 | 143.0 |
1 color DTF | 0.001 | 143.0 |
2 color | 0.02 | 28.5 |
2 color | 0.01 | 41 |
2 color | 0.005 | 52 |
2 color | 0.001 | 66 |
2 color DTF | 0.02 | 23.4 |
2 color DTF | 0.01 | 46 |
2 color DTF | 0.005 | 71 |
2 color DTF | 0.001 | 71 |
4 color | 0.02 | 14.3 |
4 color | 0.01 | 20 |
4 color | 0.005 | 26 |
4 color | 0.001 | 33 |
The measurements above were made with TriggerMode=Internal. Additional measurements made using TriggerMode=External showed that the maximum frame rate was the same as that shown in the table, i.e. as soon as the external trigger frequency exceeded this value the detector ignored every second external trigger pulse.
The data above show that the detector overhead is about 7.5 ms in "1 color low"; mode. In "1 color DTF"; mode the overhead is about 0.7 ms, but with a minimum frame period of 7 ms. In "2 color" mode the overhead is 15 ms, or 7.5 ms per image, the same as in "1 color low". In "4 color" mode two exposures are required. The total time is equal to AcquireTime*2 + 0.0075*4, so again the overhead is about 7.5 ms per image.
The following are some current restrictions of the Pixirad driver due to bugs in the Pixirad firmware: