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. The number and structure of commonly behaving pixel groups depend on detector hardware.
Implementation
Below we describe common Common mode correction algorithms used 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:
Code Block |
---|
[ImgAlgos.NDArrCalib]
source = DetInfo(:Epix100a)
key_in = ndarray-raw
key_out = ndarray-clb
do_peds = yes
do_cmod = yes
do_stat = yes
... |
where keywords do_peds
and do_cmod
should have value yes
or true
in order to turn on pedestal subtraction and common mode correction algorithms.
Detector.PyDetector
package which provides uniform access to calibration and data for all detectors.
is applied in the Detector interface method calib
described in AreaDetector:<PATH>
arr = det.calib(evt, cmpars=None)
and is controlled by the list/tuple of parameters cmpars
=(<algorithm>, <mode>, <algorithm-specific parameters>,...).
Common mode correction can be turned off using cmpars=(0,0)
.
If this list of parameters is not specified cmpars=None
, it is searched under the experimental calib directory or substituted by defaultLow level implementation of the common mode correction algorithms is done in class ImgAlgos::CommonModeCorrection
which uses methods from ImgAlgos::CommonMode
.
Each algorithm may load file with parameters from calibration directory, which by default accounts for experimnet, calibration version, data source, calibration type and run range:, for example
Code Block |
---|
/reg/d/psdm<PATH>/<INS>/<experiment>/calib/<calib-version>/<data-source>/<calibration-type>/<run-range>.data For example: <PATH>/reg/d/psdm/XPP/xppi0614/calib/Epix100a::CalibV1/NoDetector.0:Epix100a.0/pedestals/0-end.data <PATH>/reg/d/psdm/XPP/xppi0614/calib/Epix100a::CalibV1/NoDetector.0:Epix100a.0/common_mode/0-end.data |
...
We use algorithms earlier developed for CSPAD and other detectors and currently residing in ImgAlgos
and psalg
packagesavailable through the Detector package.
Selection of algorithm of particular type is controlled by the of particular type is controlled by the list of cmpars
or similar list of parameters in 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).Control file:
<PATH>/reg/d/psdm/amo/<exp-name>/calib/PNCCD::CalibV1/Camp.0:pnCCD.0/calib/PNCCD::CalibV1/Camp.0:pnCCD.0/common_mode/0-end.data
Code Block |
---|
2 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.
...
#7 - MEDIAN algorithm for jungfrau and epix10ka
This algorithm evaluates common mode offset for specified by par[1] groups of pixels using method numpy.median.
- par[0] - algorithm # 7
- par[1] - mode 0/ +1/ +2/ +4 - turned off / in rows / in columns / in banks. Each correction consumes extra time.
- par[2] - maximal allowed common mode correction in det.raw ADU to protect from over-correction at high illumination - needs to be adjusted by users per experiment
- par[3] - minimal number of good pixels in mask and gain mode to evaluate median offset (optional, default =10)
Note |
---|
rows and columns are one dimensional set of pixels limited by the shape of bank.
|
...
Default parameters:
Code Block |
---|
7 12 10010 010 0 0 0 0 0 0 0 0 0 0 0 0 |
Code:
Code Block |
---|
# cmpars=None # for default # cmpars=(7,0,100010,10) # turn off common mode correction # cmpars=(7,1,10,100010) # correction in rows # cmpars=(7,2,10,100010) # correction in columns - works the best for epix10ka # cmpars=(7,4,10,100010) # correction in banks # cmpars=(7,3,10,100010) # correction in rows and columns - works the best for jungfrau # cmpars=(7,7,100010,10) # correction in banks, rows and columns (in this order - banks first, then rows, then columns) Example: nda = det.calib(evt, cmpars=(7,3,100010,10), mbits=1, mask=None, **kwargs) |
...
Common mode correction for CSPAD2x2 in this example shows minor improvement.
References
- AreaDetector - Detector Interface is described in the head of this file.
- 2014-03-25-Ankush-CommonModeNoise.pdf - stand-alone test of common mode correction for pnCCD
- psana - Module Catalog - Module ImgAlgos::NDArrCalib
- Epix100a
- Fccd960-Detector
- numpy.median
- <PATH>