Page History
Include Page | ||||
---|---|---|---|---|
|
Table of Contents |
---|
This page provides examples for selected modules from Psana Module Catalog. Only the modules that are included in the standard analysis releases appear on this page.
Auxiliary scripts
A few python scripts in ImgPixSpectra/data/
show how to process/plot the spectral array stored in the file.
PlotSpectralArrayFromFile.py
- allows to plot content of the spectral array as a 2-d plot.SpectralArray.py
- provides access to the spectral array stored in the file. Theclass SpectralArray
defined in this script is used in thePlotSpectralArrayFromFile.py
.
MergeArrays.py
- sums the arrays from different files defined in the list and saves resulting array in a single file with the same shape. In this script the list of files is hardwired in theget_list_of_input_file_names()
method. The output file name,out_fname
, is also hardwired in the call tospectra_merging(out_fname)
.
A few auxiliary scripts for example are located in the directory ImgAlgos/data
:
psana.cfg
- set non-default parameters to runpsana
forImgAlgos::ImgPeakFinder
andImgAlgos::ImgPeakFilter
Thepsana
running this script saves images and peaks for event 115 in text files.PlotCameraImageFromFile.py
- Plots image and spectrum for image saved in file.PlotCameraImageAndPeaks.py
- Plots image with found peaks and spectrum.
Example for Package ImgPixSpectra
Modules:
- ImgPixSpectra::CSPadPixSpectra
- ImgPixSpectra::MiniCSPadPixSpectra
- ImgPixSpectra::CameraPixSpectra
The command for auxiliary script:
Code Block |
---|
ImgPixSpectra/data/PlotSpectralArrayFromFile.py mini-cspad-pix-spectra.txt
|
generates image for limited range of pixels for CSPad, MiniCSPad, or Camera, respectively:
Examples for Package ImgAlgos
See Package ImgAlgos
Example for Module ImgAlgos::ImgPeakFinder
See Module ImgAlgos::ImgPeakFinder
- This algorithm consumes ~15 ms/event on psana0101 for full Opal1000 (1024x1024) camera image.
- Smearing algorithm use a "safety margin" which is currently set to 10 pixels (offset from each boarder of the full image size).
Image on different stages of this algorithm:
- raw image,
- image in the window with amplitudes above the
threshold_low
- few peaks at the edges were discarded by the window limits,
- image still contains many 1-photon pixels, which need to be eliminated,
- smeared image,
- raw image with found peaks (marked by the red circles)
- zoom of the previous plot.
Example for Module ImgAlgos::CSPadArrAverage
See Module ImgAlgos::CSPadArrAverage
Example of the configuration file for evaluation of pedestals:
Code Block |
---|
[psana]
modules = ImgAlgos.CSPadArrAverage
files = <path-to-the-dark-run-file>.xtc
[ImgAlgos.CSPadArrAverage]
source = DetInfo(CxiDs1.0:Cspad.0)
key =
avefile = cspad-pedestals-ave.dat
rmsfile = cspad-pedestals-rms.dat
print_bits = 15
evts_stage1 = 100
evts_stage2 = 100
gate_width1 = 100
gate_width2 = 10
|
Example of the configuration file for evaluation of background:
Code Block |
---|
[psana]
modules = cspad_mod.CsPadCalib ImgAlgos.CSPadArrAverage
files = <path-to-the-background-run-file>.xtc
skip-events = 500
events = 1000000
[cspad_mod.CsPadCalib]
inputKey =
outputKey = calibrated
doPedestals = yes
doPixelStatus = no
doCommonMode = no
[ImgAlgos.CSPadArrAverage]
source = DetInfo(CxiDs1.0:Cspad.0)
key = calibrated
avefile = cspad-background-ave.dat
rmsfile = cspad-background-rms.dat
print_bits = 15
|
Images of the CSPad arrays for averaged and rms values, respectively, in one of the CXI runs:
Example for Module ImgAlgos::CSPadBkgdSubtract
See Module ImgAlgos::CSPadBkgdSubtract
The file with the background array, bkgd_fname
, was obtained by averaging 1000 events using module CSPadArrAverage. Subtraction is done with normalization for norm_sector=0
.
Event image and pixel amplitude spectrum before and after the background subtraction are shown in plots:
Other event with better subtracted background:
Example for Module ImgAlgos::ImgRadialCorrection
See Module ImgAlgos::ImgRadialCorrection
Calibrated image and spectrum:
Calibrated and radial-corrected image, spectrum, and subtracted r-phi65 distribution for n_phi_bins
=65:
Calibrated and radial-corrected image, spectrum, and subtracted r-phi12 distribution for n_phi_bins
=12: