Page History
...
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.
...
Examples for package cspad_mod
Example for module cspad_mod::CsPad2x2Pedestals
Configuration file for pedestals calibration of two CSPAD2x2 simultaneously:
Code Block |
---|
[psana]
files = /reg/d/psdm/xpp/xpptut13/xtc/e308-r0070-s02-c00.xtc \
/reg/d/psdm/xpp/xpptut13/xtc/e308-r0070-s03-c00.xtc
modules = cspad_mod.CsPad2x2Pedestals:0 \
cspad_mod.CsPad2x2Pedestals:1
#skip-events = 100
#events = 1111
[cspad_mod.CsPad2x2Pedestals:0]
source = DetInfo(XppGon.0:Cspad2x2.0)
output = pedestals-ave-xppi0513-r0070-Cspad2x2.0.dat
noise = pedestals-rms-xppi0513-r0070-Cspad2x2.0.dat
[cspad_mod.CsPad2x2Pedestals:1]
source = DetInfo(XppGon.0:Cspad2x2.1)
output = pedestals-ave-xppi0513-r0070-Cspad2x2.1.dat
noise = pedestals-rms-xppi0513-r0070-Cspad2x2.1.dat
|
Command to run this script:
Code Block |
---|
psana -c psana-xppi0513-r0070-cspad2x2-pedestals.cfg
|
The xtc file name(s) may be passed as an argument:
Code Block |
---|
psana -c psana-xppi0513-r0070-cspad2x2-pedestals.cfg /reg/d/psdm/xpp/xpptut13/xtc/e308-r0070-*.xtc
|
Output files contain results, which can be plotted for average values:
and rms values:
Example for package CSPadPixCoords
How to write the CSPad image in text file:
...
Example for
...
module CSPadPixCoords::CSPad2x2ImageProducer
See Module CSPadPixCoords::CSPad2x2ImageProducer
...
Code Block |
---|
[psana] files = /reg/d/psdm/mec/mec73313/xtc/e268-r0180-s02-c00.xtc #calib-dir = ./calib modules = cspad_mod.CsPadCalib CSPadPixCoords.CSPad2x2ImageProducer ImgAlgos.ImgSaveInFile events = 5 [cspad_mod.CsPadCalib] source = DetInfo(MecTargetChamber.0:Cspad2x2.3) inputKey = outputKey = calibrated_arr doPedestals = yes doPixelStatus = no doCommonMode = no [CSPadPixCoords.CSPad2x2ImageProducer] calibDir = /reg/d/psdm/mec/mec73313/calib typeGroupName = CsPad2x2::CalibV1 #source = DetInfo(MecTargetChamber.0:Cspad2x2.3) source = :Cspad2x2.3 inkey = calibrated_arr outimgkey = Image tiltIsApplied = true print_bits = 15 [ImgAlgos.ImgSaveInFile] source = DetInfo(MecTargetChamber.0:Cspad2x2.3) key = Image fname = cspad2x2.3 saveAll = true print_bits = 3 #eventSave = 5 |
Example for
...
package ImgPixSpectra
Modules:
...
generates image for limited range of pixels for CSPad, MiniCSPad, or Camera, respectively:
Examples for
...
package ImgAlgos
See Package ImgAlgos
Example for
...
module ImgAlgos::Tahometer
See Module ImgAlgos::Tahometer
...
Code Block |
---|
[psana] files = /reg/d/psdm/<INSTRUMENT>/<experiment>/xtc/<file-name-1>.xtc\ /reg/d/psdm/<INSTRUMENT>/<experiment>/xtc/<file-name-2>.xtc modules = ImgAlgos.Tahometer [ImgAlgos.Tahometer] dn = 10 print_bits = 7 |
Example for
...
module ImgAlgos::PnccdImageProducer
See Module ImgAlgos::PnccdImageProducer
...
This script saves text files with images like pnccd-img-ev-<run-date-time.nsec>.txt
, which can be presented as:
Example for
...
module ImgAlgos::CameraImageProducer
See Module ImgAlgos::CameraImageProducer
...
./ImgAlgos/data/PlotCameraImageFromFile.py <filename>.txt <Amin> <Amax>
Example for
...
module ImgAlgos::PrincetonImageProducer
See Module ImgAlgos::PrincetonImageProducer
...
Code Block |
---|
[psana] files = /reg/d/psdm/<INSTRUMENT>/<experiment>/xtc/<file-name-1>.xtc\ /reg/d/psdm/<INSTRUMENT>/<experiment>/xtc/<file-name-2>.xtc modules = ImgAlgos.PrincetonImageProducer \ ImgAlgos.ImgSaveInFile events = 3 [ImgAlgos.PrincetonImageProducer] source = DetInfo(:Princeton) key_in = key_out = img subtract_offset = true print_bits = 31 [ImgAlgos.ImgSaveInFile] source = DetInfo(:Princeton) key = img fname = img-xcs saveAll = true print_bits = 31 |
Example for
...
module ImgAlgos::ImgAverage
See Module ImgAlgos::ImgAverage
...
Code Block |
---|
[psana] files = /reg/d/psdm/<instrument>/<experiment>/xtc/<file-name>.xtc modules = ImgAlgos.CameraImageProducer \ ImgAlgos.ImgAverage events = 1000 [ImgAlgos.CameraImageProducer] source = DetInfo(:Opal1000) key_in = key_out = img subtract_offset = true print_bits = 1 [ImgAlgos.ImgAverage] source = DetInfo(:Opal1000) key = img avefile = img-ave.dat rmsfile = img-rms.dat print_bits = 31 evts_stage1 = 100 evts_stage2 = 100 gate_width1 = 200 gate_width2 = 20 |
Example for
...
module ImgAlgos::ImgMaskEvaluation
See Module ImgAlgos::ImgMaskEvaluation
...
Masks: noisy, saturated, and combined:
Example for
...
module ImgAlgos::ImgCalib
...
Example of the mask file and resulting image:
Example for
...
module ImgAlgos::ImgRadialCorrection
See Module ImgAlgos::ImgRadialCorrection
...
Calibrated and radial-corrected image, spectrum, and subtracted r-phi12 distribution for n_phi_bins
=12:
Example for
...
module ImgAlgos::ImgPeakFinder
See Module ImgAlgos::ImgPeakFinder
...
- 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::ImgPeakFilter
Code Block |
---|
[ImgAlgos.ImgPeakFilter] source = DetInfo(:Opal1000) key = peaks threshold_peak = 5 threshold_total= 0 n_peaks_min = 10 print_bits = 11 fname = img selection_mode = SELECTION_ON |
Example for
...
module ImgAlgos::ImgPeakFinderAB
See Module ImgAlgos::ImgPeakFinderAB
...
Code Block |
---|
[psana] files = /reg/d/psdm/<instrument>/<experiment>/xtc/<file-name>.xtc modules = ImgAlgos.CameraImageProducer \ ImgAlgos.ImgPeakFinderAB events = 10 [ImgAlgos.CameraImageProducer] source = DetInfo(:Opal1000) key_in = key_out = img subtract_offset = true print_bits = 1 [ImgAlgos.ImgPeakFinderAB] source = DetInfo(:Opal1000) key = img key_peaks_out = peaks #key_signal_out = signal-arr #hot_pix_mask_inp_file = ana-misc-exp/mask.dat #hot_pix_mask_out_file = noise-mask-out.dat #frac_noisy_evts_file = noise-frac-out.dat evt_file_out = tmp/img- rmin = 10 dr = 1 SoNThr_noise = 3 SoNThr_signal = 3 frac_noisy_imgs = 0.9 peak_npix_min = 3 peak_npix_max = 100 peak_amp_tot_thr = 0. peak_SoN_thr = 4. event_npeak_min = 5 event_npeak_max = 1000 event_amp_tot_thr = 0. nevents_mask_update = 0 nevents_mask_accum = 50 selection_mode = SELECTION_ON out_file_bits = 15 print_bits = 513 |
Results:
Example for
...
module ImgAlgos::ImgSpectra
See Module ImgAlgos::ImgSpectra
Configuration file for psana:
...
This script can be used in order to produce text files with image and spectral array:
or graphics for several images:
Example for
...
module ImgAlgos::ImgSpectraProc
See Module ImgAlgos::ImgSpectraProc
Configuration file for psana:
...
Code Block |
---|
[info:ImgAlgos.ImgSpectraProc] Spectral array shape =3, 1024 [info:ImgAlgos.ImgSpectraProc] Image spectra for run=0060 Evt=000100 Column: 0 100 200 300 400 500 600 700 800 900 1000 Signal: 1211 4062 11150 17070 16406 12949 7991 5168 3968 3542 3811 Refer.: 933 3485 10425 17128 17791 13522 8315 5000 3390 2967 3193 Diff. : 0.259 0.153 0.067 -0.003 -0.081 -0.043 -0.040 0.033 0.157 0.177 0.176 [info:ImgAlgos.ImgSpectraProc] Run=0060 Evt=000100 Time=20120507-125420.982421325 done... |
Example for
...
module ImgAlgos::ImgSaveInFile
Code Block |
---|
modules = ... ImgAlgos.ImgSaveInFile:1 ... [ImgAlgos.ImgSaveInFile:1] source = DetInfo(:Opal1000) # or CxiDs1.0:Cspad.0 key = img fname = my-img #ftype = txt #ftype = bin #ftype = png ftype = tiff #eventSave = 5 saveAll = true |
See Module ImgAlgos::ImgSaveInFile
Example for
...
module ImgPeakFinder and ImgPeakFilter for CSPad
Module ImgAlgos::ImgPeakFinder
works on image. In order to apply this algorithm to CSPad the image should be produced. In next example the image is produced using consequtive modules cspad_mod.CsPadCalib
, ImgAlgos.CSPadMaskApply
, and CSPadPixCoords.CSPadImageProducer
:
Code Block |
---|
[psana] files = /reg/d/psdm/<instrument>/<experiment>/xtc/<file-name-1>.xtc \ ... /reg/d/psdm/<instrument>/<experiment>/xtc/<file-name-N>.xtc events = 1000 experiment = cxii0212 calib-dir = ana-cxii0212/calib modules = cspad_mod.CsPadCalib \ ImgAlgos.CSPadMaskApply \ CSPadPixCoords.CSPadImageProducer \ ImgAlgos.ImgPeakFinder \ ImgAlgos.ImgPeakFilter \ ImgAlgos.ImgSaveInFile:1 [cspad_mod.CsPadCalib] inputKey = outputKey = calibrated doPedestals = yes doPixelStatus = no doCommonMode = yes [ImgAlgos.CSPadMaskApply] source = DetInfo(CxiDs1.0:Cspad.0) inkey = calibrated outkey = masked_arr mask_fname = <your-local-directory>/<mask-file-name>.dat masked_amp = 0 print_bits = 5 mask_control_bits = 15 [CSPadPixCoords.CSPadImageProducer] calibDir = /reg/d/psdm/<instrument>/<experiment>/calib typeGroupName = CsPad::CalibV1 source = CxiDs1.0:Cspad.0 key = masked_arr imgkey = img print_bits = 0 #tiltIsApplied = true [ImgAlgos.ImgPeakFinder] source = DetInfo(CxiDs1.0:Cspad.0) key = img peaksKey = peaks threshold_low = 2 threshold_high = 5 sigma = 1.5 smear_radius = 5 peak_radius = 7 xmin = 20 xmax = 1700 ymin = 20 ymax = 1700 #testEvent = 5 print_bits = 3 #finderIsOn = true [ImgAlgos.ImgPeakFilter] source = DetInfo(CxiDs1.0:Cspad.0) key = peaks threshold_peak = 5 threshold_total= 0 n_peaks_min = 10 print_bits = 11 fname = cspad-img selection_mode = SELECTION_ON [ImgAlgos.ImgSaveInFile:1] source = CxiDs1.0:Cspad.0 key = img fname = cspad-img #eventSave = 1 saveAll = true |
Example for
...
module ImgAlgos::CSPadArrAverage
See Module ImgAlgos::CSPadArrAverage
...
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
...
Input parameter mask_control_bits
allows to control masking regions of 2x1. For example, if all edges need to be masked, then use mask_control_bits = 15
, which gives image array like:
where red regions/lines of pixels of amplitude=8 are masked.
Example for
...
module ImgAlgos::CSPadArrNoise
See Module ImgAlgos::CSPadArrNoise
...
Selected events
ev-007713:
ev-008944:
Example for
...
module ImgAlgos::CSPadArrPeakAnalysis
See Module ImgAlgos::CSPadArrPeakAnalysis
...