Page History
...
Photon conversion in pixel detectors quite often happens in the region between pixels. Ionization produced by photon splits between two or rarely more pixels. Photon is complicated by the split photons between neighboring pixels. In some cases, energy deposited by a photon is split between two or (sometimes) more pixels. The photon counting algorithm described here is designed to account for this effect and return an unassembled array with correct number of photons per pixel. Pythonic API for this algorithm is pretty simpleas follows:
Code Block |
---|
# Import from ImgAlgos.PyAlgos import photons import psana # Initialize a detector object det = psana.Detector(detInfo, env) # Merges photons split among pixels and returns n-d array with integer number of photons per pixel. nphotons_nda = det.photons(fphotonsevt, adu_per_photon, nda_calib=None, mask=None) |
...
The det.photons() function divides the pixel intensities (ADUs) by adu_per_photon, resulting in a fractional number of photons for each pixel. This function is a wrapper around photons() method in PyAlgos:
Code Block |
---|
# Import
from ImgAlgos.PyAlgos import photons
# Merges photons split among pixels and returns n-d array with integer number of photons per pixel.
nphotons_nda = photons(fphotons, mask) |
Method photons
receives (float) n-d numpy array fphotons
representing image intensity in terms of (float) fractional number of photons and an associated mask
of bad pixels. Both arrays should have the same shape. Two lowest dimensions represent pixel rows and columns in 2-d pixel matrix arrays. Algorithm works with good pixels defined by the mask array (1/0 = good/bad pixel). Array fphotons
is represented with two arrays; An array containing whole number of photons (integer) and the leftover fractional number of photon array (float) of the same shape. Assuming the photons are only split between two adjacent pixels, we round up the adjacent pixels if they sum up to be above 0.9 photons. The algorithm is best explained using an example:
Let's say we measured the following ADUs on our detector.
Code Block |
---|
ADUs (adu_per_photon=1):
0.0 3.5 0.1 0.2
0.2 0.4 0.0 1.2
0.1 4.7 3.4 0.0
0.5 0.4 0.4 0.1 |
We expect the converted photon counts to be:
Code Block |
---|
Photons:
0 4 0 0
0 0 0 1
0 5 3 0
1 0 0 0 |
To see how we get from ADUs to Photons, we split the ADUs into whole photons and fractional photons.
Code Block |
---|
ADUs = Whole photons + Fractional photons
Whole photons + Fractional photons
0 3 0 0 0.0 0.5 0.1 0.2
0 0 0 1 0.2 0.4 0.0 0.2
0 4 3 0 0.1 0.7 0.4 0.0
0 0 0 0 0.5 0.4 0.4 0.1 |
Assuming the photons are only split by two adjacent pixels, we search for a pixel that has at least 0.5 photons with an adjacent pixel that sum up to above 0.9 photons. In cases where a pixel has multiple adjacent pixels which sum up to above 0.9 photons, we take the largest adjacent pixel. If such an adjacent pair of pixels is found, then the adjacent pixel values are merged into one pixel. It is merged into the pixel with the larger value. (See "After merging adjacent pixels" example below).
The merged adjacent pixels are then rounded to whole photons. (See "Rounded whole photons" example below).
Code Block |
---|
Fractional photons
0.0 0.5 0.1 0.2
0.2 0.4 0.0 0.2
0.1 0.7 0.4 0.0
0.5 0.4 0.4 0.1
After merging adjacent pixels:
0.0 0.9 0.1 0.0
0.2 0.0 0.0 0.0
0.1 1.1 0.0 0.0
0.9 0.0 0.4 0.1
Rounded whole photons:
0 1 0 0
0 0 0 0
0 1 0 0
1 0 0 0 |
Photons is then the sum of "Whole photons" and "Rounded whole photons":
Code Block |
---|
Photons = Whole photons + Rounded whole photons:
0 4 0 0 0 3 0 0 0 1 0 0
0 0 0 1 = 0 0 0 1 + 0 0 0 0
0 5 3 0 0 4 3 0 0 1 0 0
1 0 0 0 0 0 0 0 1 0 0 0 |
References
- ImgAlgos.PyAlgos - code example in Sphinx documentation
- Peak Finding - short announcement about peak finders
- Hit and Peak Finders - examples in Chris' tutorial
- Peak Finding Module - (depricated) psana module, it demonstaration examples and results
- Psana Module Catalog - (depricated) peak finding psana modules
- Psana Module Examples - (depricated) peak finding examples in psana modules
- GUI for tuning peak finding - Chun's page in development
pyimgalgos.PeakStore - class helping to save peak parameter records in the text file
pyimgalgos.TDFileContainer - class helping to retrieve peak parameter records from the text file
Test of Peak Finders - example of exploitation of peak finders
- Test of Peak Finders - V2 - example of exploitation of peak finders after revision 1 (uniformization)
- photons - sphinx doc
...