git-svn-id: https://subversion.xor.aps.anl.gov/synApps/areaDetector/trunk@11324 dc6c5ff5-0b8b-c028-a01f-ffb33f00fc8b
544 lines
15 KiB
HTML
Executable File
544 lines
15 KiB
HTML
Executable File
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>areaDetector Simulation driver</title>
|
|
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
|
|
</head>
|
|
<body>
|
|
<div style="text-align: center">
|
|
<h1 style="text-align: center">
|
|
areaDetector Simulation driver</h1>
|
|
<h2>
|
|
May 19, 2010</h2>
|
|
<h2>
|
|
Mark Rivers</h2>
|
|
<h2>
|
|
University of Chicago</h2>
|
|
</div>
|
|
<p>
|
|
</p>
|
|
<h2>
|
|
Table of Contents</h2>
|
|
<ul>
|
|
<li><a href="#Introduction">Introduction</a></li>
|
|
<li><a href="#Driver_parameters">Simulation driver specific parameters</a></li>
|
|
<li><a href="#Unsupported">Unsupported standard driver parameters</a></li>
|
|
<li><a href="#ImageTypes">Image Types</a>
|
|
<ol>
|
|
<li><a href="#LinearRamp">Linear Ramp</a></li>
|
|
<li><a href="#Peaks">Array of Peaks</a></li>
|
|
<li><a href="#Rings">Array of Rings</a></li>
|
|
</ol>
|
|
</li>
|
|
<li><a href="#Configuration">Configuration</a></li>
|
|
<li><a href="#MEDM_screens">MEDM screens</a></li>
|
|
<li><a href="#Viewers">Image viewers</a></li>
|
|
</ul>
|
|
<h2 id="Introduction">
|
|
Introduction</h2>
|
|
<p>
|
|
simDetector is a driver for a simulated area detector. The simulation detector is
|
|
useful as a model for writing real detector drivers. It is also very useful for
|
|
testing plugins and channel access clients.
|
|
</p>
|
|
<p>
|
|
This driver inherits from <a href="areaDetectorDoc.html#ADDriver">ADDriver</a>.
|
|
It implements nearly all of the parameters in <a href="areaDetectorDoxygenHTML/asyn_n_d_array_driver_8h.html">
|
|
asynNDArryDriver.h</a> and in <a href="areaDetectorDoxygenHTML/_a_d_driver_8h.html">
|
|
ADArrayDriver.h</a>, with the exception of the file saving parameters, which
|
|
it does not implement. It also implements a few parameters that are specific to
|
|
the simulation detector. The <a href="areaDetectorDoxygenHTML/classsim_detector.html">
|
|
simDetector class documentation</a> describes this class in detail.</p>
|
|
<p>
|
|
The writeInt32 and writeFloat64 methods override those in the base class. The driver
|
|
takes action when new parameters are passed via those interfaces. For example, the
|
|
ADAcquire parameter (on the asynInt32 interface) is used to turn acquisition (i.e.
|
|
computing new images) on and off.
|
|
</p>
|
|
<h2 id="Driver_parameters">
|
|
Simulation driver specific parameters</h2>
|
|
<p>
|
|
The simulation driver-specific parameters are the following:
|
|
</p>
|
|
<table border="1" cellpadding="2" cellspacing="2" style="text-align: left">
|
|
<tbody>
|
|
<tr>
|
|
<td align="center" colspan="7">
|
|
<b>Parameter Definitions in simDetector.cpp and EPICS Record Definitions in simDetector.template</b></td>
|
|
</tr>
|
|
<tr>
|
|
<th>
|
|
Parameter index variable</th>
|
|
<th>
|
|
asyn interface</th>
|
|
<th>
|
|
Access</th>
|
|
<th>
|
|
Description</th>
|
|
<th>
|
|
drvInfo string</th>
|
|
<th>
|
|
EPICS record name</th>
|
|
<th>
|
|
EPICS record type</th>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimGainX</td>
|
|
<td>
|
|
asynFloat64</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Gain in the X direction</td>
|
|
<td>
|
|
SIM_GAINX</td>
|
|
<td>
|
|
$(P)$(R)GainX<br />
|
|
$(P)$(R)GainX_RBV</td>
|
|
<td>
|
|
ao<br />
|
|
ai</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimGainY</td>
|
|
<td>
|
|
asynFloat64</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Gain in the Y direction</td>
|
|
<td>
|
|
SIM_GAINY</td>
|
|
<td>
|
|
$(P)$(R)GainY<br />
|
|
$(P)$(R)GainY_RBV</td>
|
|
<td>
|
|
ao<br />
|
|
ai</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimGainRed</td>
|
|
<td>
|
|
asynFloat64</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Gain of the red channel</td>
|
|
<td>
|
|
SIM_GAIN_RED</td>
|
|
<td>
|
|
$(P)$(R)GainRed<br />
|
|
$(P)$(R)GainRed_RBV</td>
|
|
<td>
|
|
ao<br />
|
|
ai</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimGainGreen</td>
|
|
<td>
|
|
asynFloat64</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Gain of the green channel</td>
|
|
<td>
|
|
SIM_GAIN_GREEN</td>
|
|
<td>
|
|
$(P)$(R)GainGreen<br />
|
|
$(P)$(R)GainGreen_RBV</td>
|
|
<td>
|
|
ao<br />
|
|
ai</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimGainBlue</td>
|
|
<td>
|
|
asynFloat64</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Gain of the blue channel</td>
|
|
<td>
|
|
SIM_GAIN_BLUE</td>
|
|
<td>
|
|
$(P)$(R)GainBlue<br />
|
|
$(P)$(R)GainBlue_RBV</td>
|
|
<td>
|
|
ao<br />
|
|
ai</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimResetImage</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Set to 1 to reset image back to initial conditions</td>
|
|
<td>
|
|
RESET_IMAGE</td>
|
|
<td>
|
|
$(P)$(R)Reset<br />
|
|
$(P)$(R)Reset_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimImageType</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Set the image type to be displayed. Options are:<br/>
|
|
<ul>
|
|
<li>Linear Ramp</li>
|
|
<li>Array of Peaks (mono only)</li>
|
|
<li>Array of Rings (Not yet implemented)</li>
|
|
</ul>
|
|
</td>
|
|
<td>
|
|
SIM_IMAGE_TYPE</td>
|
|
<td>
|
|
$(P)$(R)ImageType<br />
|
|
$(P)$(R)ImageType_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimNoise</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Used to introduce randomness. Each affected pixel is assigned a scaling factor.<br/>
|
|
scalingFactor = 1.0 + (rand()%noise +1)/100.0
|
|
</td>
|
|
<td>
|
|
SIM_NOISE</td>
|
|
<td>
|
|
$(P)$(R)Noise<br />
|
|
$(P)$(R)Noise_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td><b>Parameters for Peak Array</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksStartX</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
X location of the first peak centroid</td>
|
|
<td>
|
|
SIM_PEAK_START_X</td>
|
|
<td>
|
|
$(P)$(R)PeakStartX<br />
|
|
$(P)$(R)PeakStartX_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksStartY</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Y location of the first peak centroid</td>
|
|
<td>
|
|
SIM_PEAK_START_Y</td>
|
|
<td>
|
|
$(P)$(R)PeakStartY<br />
|
|
$(P)$(R)PeakStartY_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksWidthX</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
X width of the peaks</td>
|
|
<td>
|
|
SIM_PEAK_WIDTH_X</td>
|
|
<td>
|
|
$(P)$(R)PeakWidthX<br />
|
|
$(P)$(R)PeakWidthX_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksWidthY</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Y width of the peaks</td>
|
|
<td>
|
|
SIM_PEAK_WIDTH_Y</td>
|
|
<td>
|
|
$(P)$(R)PeakWidthY<br />
|
|
$(P)$(R)PeakWidthY_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksNumX</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Number of peaks in X direction</td>
|
|
<td>
|
|
SIM_PEAK_NUM_X</td>
|
|
<td>
|
|
$(P)$(R)PeakNumX<br />
|
|
$(P)$(R)PeakNumX_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksNumY</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Number of peaks in Y direction</td>
|
|
<td>
|
|
SIM_PEAK_NUM_Y</td>
|
|
<td>
|
|
$(P)$(R)PeakNumY<br />
|
|
$(P)$(R)PeakNumY_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksStepX</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
X step between peaks</td>
|
|
<td>
|
|
SIM_PEAK_STEP_X</td>
|
|
<td>
|
|
$(P)$(R)PeakStepX<br />
|
|
$(P)$(R)PeakStepX_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeaksStepY</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Y location of the first peak centroid</td>
|
|
<td>
|
|
SIM_PEAK_STEP_Y</td>
|
|
<td>
|
|
$(P)$(R)PeakStepY<br />
|
|
$(P)$(R)PeakStepY_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
SimPeakHeightVariation</td>
|
|
<td>
|
|
asynInt32</td>
|
|
<td>
|
|
r/w</td>
|
|
<td>
|
|
Used to introduce randomness. Each gaussian peak in the array is assigned a scaling factor.<br/>
|
|
scalingFactor = 1.0 + (rand()%peakVariation +1)/100.0
|
|
</td>
|
|
<td>
|
|
SIM_PEAK_HEIGHT_VARIATION</td>
|
|
<td>
|
|
$(P)$(R)PeakVariation<br />
|
|
$(P)$(R)PeakVariation_RBV</td>
|
|
<td>
|
|
longout<br />
|
|
longin</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h2 id="ImageTypes">Image Types</h2>
|
|
<h3 id="LinearRamp">Linear Ramp</h3>
|
|
<p>
|
|
For monochrome images (NDColorMode=NDColorModeMono) the simulation driver initially
|
|
sets the image[i, j] = i*SimGainX + j*SimGainY * ADGain * ADAcquireTime * 1000.
|
|
Thus the image is a linear ramp in the X and Y directions, with the gains in each
|
|
direction being detector-specific parameters. Each subsquent acquisition increments
|
|
each pixel value by ADgain*ADAcquireTime*1000. Thus if ADGain=1 and ADAcquireTime=.001
|
|
second then the pixels are incremented by 1. If the array is an unsigned 8 or 16
|
|
bit integer then the pixels will overflow and wrap around to 0 after some period
|
|
of time. This gives the appearance of bands that appear to move with time. The slope
|
|
of the bands and their periodicity can be adjusted by changing the gains and acquire
|
|
times.
|
|
</p>
|
|
<p>
|
|
For color images (NDColorMode=NDColorModeRGB1, RGB2 or RGB3) there are 3 images
|
|
computed, one each for the red, green and blue channels. Each image is computed
|
|
with the same algorithm as for the monochrome case, except each is multiplied by
|
|
its appropriate gain factor (SimGainRed, SimGainGreen, SimGainBlue). Thus if each
|
|
of these color gains is 1.0 the color image will be identical to the monochrome
|
|
image, but if the color gains are different from each other then image will have
|
|
color bands.</p>
|
|
<h3 id="Peaks">Array of Peaks</h3>
|
|
<p>
|
|
For monochrome images, an array of gaussian peaks is produced. The user specifies the
|
|
start location for the first peak in PeakStartX & PeakStartY. The size of the peak is
|
|
controlled by PeakWidthX and PeakWidthY. The array is specified by giving the number of
|
|
peaks in each direction with PeakNumX and PeakNumY and the step size between peak centroids
|
|
with PeakStepX and PeakStepY. Note that data for each peak is only added to the image over a
|
|
range of four times the PeakWidth in any direction (in the interest of speed).
|
|
</p>
|
|
<p>
|
|
Dynamic behavior can be introduced into the system by changing PeakVariation and Noise
|
|
records. PeakVariation introduces variation on each pixel in the array and Noise introduces
|
|
variation in each pixel.
|
|
</p>
|
|
<p>
|
|
RGB implementation will be added later.
|
|
</p>
|
|
<h3 id="Rings">Array of Rings</h3>
|
|
<p>
|
|
An array of Rings will be added later.
|
|
</p>
|
|
|
|
|
|
<h2 id="Unsupported">
|
|
Unsupported standard driver parameters</h2>
|
|
<ul>
|
|
<li>Collect: Number of exposures per image (ADNumExposures)</li>
|
|
<li>Collect: Trigger mode (ADTriggerMode)</li>
|
|
<li>File control: No file I/O is supported</li>
|
|
</ul>
|
|
<h2 id="Configuration">
|
|
Configuration</h2>
|
|
<p>
|
|
The simDetector driver is created with the simDetectorConfig command, either from
|
|
C/C++ or from the EPICS IOC shell.</p>
|
|
<pre>int simDetectorConfig(const char *portName,
|
|
int maxSizeX, int maxSizeY, int dataType,
|
|
int maxBuffers, size_t maxMemory,
|
|
int priority, int stackSize)
|
|
</pre>
|
|
<p>
|
|
The simDetector-specific fields in this command are:</p>
|
|
<ul>
|
|
<li><code>maxSizeX</code> Maximum number of pixels in the X direction for the simulated
|
|
detector.</li>
|
|
<li><code>maxSizeY</code> Maximum number of pixels in the Y direction for the simulated
|
|
detector. </li>
|
|
<li><code>dataType</code> Initial data type of the detector data. These are the enum
|
|
values for NDDataType_t, i.e.
|
|
<ul>
|
|
<li>0=NDInt8</li>
|
|
<li>1=NDUInt8</li>
|
|
<li>2=NDInt16</li>
|
|
<li>3=NDUInt16</li>
|
|
<li>4=NDInt32</li>
|
|
<li>5=NDUInt32</li>
|
|
<li>6=NDFloat32</li>
|
|
<li>7=NDFloat64</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
For details on the meaning of the other parameters to this function refer to the
|
|
detailed documentation on the simDetectorConfig function in the <a href="areaDetectorDoxygenHTML/sim_detector_8cpp.html">
|
|
simDetector.cpp documentation</a> and in the documentation for the constructor
|
|
for the <a href="areaDetectorDoxygenHTML/classsim_detector.html">simDetector class</a>.
|
|
</p>
|
|
<p>
|
|
There an example IOC boot directory and startup script (<a href="simdetector_st_cmd.html">iocBoot/iocSimDetector/st.cmd)</a>
|
|
provided with areaDetector.
|
|
</p>
|
|
<h2 id="MEDM_screens">
|
|
MEDM screens</h2>
|
|
<p>
|
|
The following is the MEDM screen simDetector.adl for the simulation detector.
|
|
</p>
|
|
<div style="text-align: center">
|
|
<h3>
|
|
simDetector.adl</h3>
|
|
<img alt="simDetector.png" src="simDetector.png" />
|
|
</div>
|
|
<p>
|
|
The following is the MEDM screen that provides access to the specific parameters
|
|
for the simulation detector.
|
|
</p>
|
|
<div style="text-align: center">
|
|
<h3>
|
|
simDetectorMore.adl</h3>
|
|
<img alt="simDetectorMore.png" src="simDetectorMore.png" />
|
|
</div>
|
|
<h2 id="Viewers">
|
|
Image viewers</h2>
|
|
<p>
|
|
The following is an IDL <a href="areaDetectorViewers.html#IDLViewer">epics_ad_display</a>
|
|
screen using <a href="http://cars.uchicago.edu/software/idl/imaging_routines.html#image_display">
|
|
image_display</a> to display the simulation detector images.
|
|
</p>
|
|
<div style="text-align: center">
|
|
<h3>
|
|
epics_ad_display.pro</h3>
|
|
<img alt="simDetector_image_display.png" src="simDetector_image_display.png" />
|
|
</div>
|
|
<p>
|
|
The following is an ImageJ plugin <a href="areaDetectorViewers.html#ImageJViewer">
|
|
EPICS_AD_Viewer</a> screen displaying color simulation detector images.
|
|
</p>
|
|
<div style="text-align: center">
|
|
<h3>
|
|
ImageJ plugin EPICS_AD_Viewer</h3>
|
|
<img alt="simDetector_ImageJ_display.png" src="simDetector_ImageJ_display.png" />
|
|
</div>
|
|
</body>
|
|
</html>
|