Page History
...
In this note we discuss common mode correction algorithms. Common mode is a hardware effect of collective pixel intensity variation due to synchronous variation of potentials on sensor chip or ADC at readout process. This effect can be corrected at low sensor illumination, where the number of pixels with energy deposition from photons is small. The spectrum of pixel intensities without photons should be grouped in the peak with small offset of the average from zero (if the dark rate correction is already applied) due to the common mode effect. This offset can be evaluated and subtracted from all pixel intensities in the group of synchronously fluctuating pixels. This correction is detector-dependent, because detectors may have many ADCs working on different groups of pixels. Algorithms are also detector-dependent in order to better account for sensor behaviour. The number and structure of commonly behaving pixel groups depend on detector hardware.
Implementation
Below we describe common mode correction algorithms implemented in psana module ImgAlgos::NDArrCalib
. This correction along with others can be applied to raw ndarray under control of the psana configuration file for specified detector, for example for Epix100a:
...
In module ImgAlgos::NDArrCalib
we use algorithms earlier developed for CSPAD and other detectors and currently residing in ImgAlgos
and and psalg
packages.
Selection of algorithm of particular type is controlled by the parameters in file for common_mode
calibration type.
#1 - common mode peak finding algorithm
This algorithm is similar to one developed by Andy Salnikov and implemented in cspad_mod.CsPadCalib;
- for each cspad2x1 sensor the pixels' intensity histogram is filled for natural ADU bins, pixels with bad status are ignored,
- search for the peak in the histogram corresponding to the dark pixels using thresholds,
- iterate over bins around the peak region and improve the peak location precision, that defines the common
...
- mode correction
- if correction is in allowed range then apply it to all sensor pixels.
Control parameters for this algorithm resides in the file for common_mode
calibration type;
parameters for CSPAD and CSPAD2x2
Code Block |
---|
1 50 50 100 |
- par[0] - algorithm #
- par[1] - maximal deviation of the peak mean from 0
- par[2] - maximal allowed value of the peak RMS
- par[3] -threshold on number of pixels in the ADU bin in the peak finding algorithm
parameters for other detectors
- par[4] - number of segments for common mode evaluation
- par[5] - segment size (number of pixels for common mode evaluation)
par[6] - stride (step for jump to the next pixel)
For example:
Code Block 1 50 50 100 8192 128 1
#2 - MEAN
...
algorithm
It was developed by Philip Hart for test purpose;
- for each group of pixels intensity histogram is filled for natural ADU bins, pixels with bad status are ignored,
- a simple mean below threshold is considered as a common mode correction,
- if correction is in the allowed range, it is applied to all pixels from the group.
Control parameters for this algorithm resides in the file for common_mode
calibration type;
- par[0] - algorithm #
- par[1] - maximal threshold on intensity to evaluate mean for low intensities
- par[2] - maximal allowed common mode correction
par[3] - length of consecutive pixel array for common mode evaluation
For example, for pnCCD one can evaluate common-mode for one came chip (128 channels):Code Block 1 1000 1000 128
- The algorithm loops over the data and evaluates consecutive arrays of specified length (which might represent for example a row of pixels in a readout chip) and finds the mean value for values below a threshold, ignoring masked pixels. It corrects all the data if the calculated common mode is less than the maximal allowed correction. The median algorithm is more stable in many cases and is recommended.
#3 - MEDIAN
...
algorithm
It was developed by Philip Hart as a replacement for the mean (#2) algorithm;
- for each group of pixels intensity histogram is filled for natural ADU bins, pixels with bad status are ignored,
- a half of statistics counted from bin with low intensities below threshold is considered as a common mode correction,
- if correction is in the allowed range, it is applied to all pixels from the group.
Parameters are the same as in #2. The algorithm is as above, except that it calculates the median, or the average of the two median points if there are an even number passing the selection criteria.
#4 - MEDIAN algorithm - detector dependent
It is pretty similar to one developed by Matthew Weaver that is implemented in ami/event/FrameCalib
In ImgAlgos::NDArrCalib
it is implemented for Epix100a and Fccd960.
The difference from algorithm #3 is quite minor; it starts to fill the intensity histogram in a quite narrow range relative to zero, but if the half of statistics is not found in this range it is extended by 1/4 of pixels. This iterations are repeated until the half of statistics is in the range, or the number of bins exceeds 10000.
Typical common_mode
control parameters:
Code Block |
---|
4 1 30 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
where
- (4) - algorithm number; 4 stands for this median algorithm,
- (1) - type of regions for median algorithm; 3 regions for Epix100a, and 2 regions for Fccd960
- (30) - hint on common mode correction half-range (relative to 0) in ADU,
- (10) - maximal allowed absolute value of the common mode correction in ADU.
Other parameters are not used.
Test of the common mode correction for pnCCD
...