Page History
...
Include Page | ||||
---|---|---|---|---|
|
About
This page provides examples for selected modules from Psana Module Catalog.
Auxiliary scripts
A few python scripts in ImgPixSpectra/data/
show how to process/plot the spectral array stored in the file.
...
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:
...
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/xpp/xpptut13/xtc/e308-r0008-s02-c00.xtc \ /reg/d/psdm/xpp/xpptut13/xtc/e308-r0008-s03-c00.xtc #modules = cspad_mod.CsPad2x2Pedestals #calib-dir = ./calib calib-dir = /reg/d/psdm/xpp/xpptut13/xtc/calib modules = cspad_mod.CsPadCalib:0 \ cspad_mod.CsPadCalib:1 \ CSPadPixCoords.CSPad2x2ImageProducer:0 \ CSPadPixCoords.CSPad2x2ImageProducer:1 \ ImgAlgos.ImgSaveInFile:0 \ ImgAlgos.ImgSaveInFile:1 events = 5 [cspad_mod.CsPadCalib:0] source = DetInfo(XppGon.0:Cspad2x2.0) inputKey = outputKey = calibrated_arr0 doPedestals = yes doPixelStatus = no doCommonMode = yes [cspad_mod.CsPadCalib:1] source = DetInfo(XppGon.0:Cspad2x2.1) inputKey = outputKey = calibrated_arr1 doPedestals = yes doPixelStatus = no doCommonMode = yes [CSPadPixCoords.CSPad2x2ImageProducer:0] calibDir = /reg/d/psdm/xpp/xpptut13/xtc/calib typeGroupName = CsPad2x2::CalibV1 source = DetInfo(XppGon.0:Cspad2x2.0) inkey = calibrated_arr0 outimgkey = Image tiltIsApplied = false useWidePixCenter = false print_bits = 15 [CSPadPixCoords.CSPad2x2ImageProducer:1] calibDir = /reg/d/psdm/xpp/xpptut13/xtc/calib typeGroupName = CsPad2x2::CalibV1 source = DetInfo(XppGon.0:Cspad2x2.1) inkey = calibrated_arr1 outimgkey = Image tiltIsApplied = false useWidePixCenter = false print_bits = 15 [ImgAlgos.ImgSaveInFile:0] source = DetInfo(:Cspad2x2.0) key = Image fname = cspad2x2.0 ftype = txt #ftype = tiff saveAll = true print_bits = 3 #eventSave = 5 [ImgAlgos.ImgSaveInFile:1] source = DetInfo(:Cspad2x2.1) key = Image fname = cspad2x2.1 #ftype = txt ftype = tiff 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
...
Other event with better subtracted background:
Example for Module ImgAlgos::CSPadMaskApply
See Module ImgAlgos::CSPadMaskApply
...
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
...
Pixel mask for noisy pixels with |S/N| > SoNThr
:
Example for Module ImgAlgos::CSPadArrPeakFinder
See Module ImgAlgos::CSPadArrPeakFinder
...
Selected events
ev-007713:
ev-008944:
Example for module ImgAlgos::CSPadArrPeakAnalysis
See Module ImgAlgos::CSPadArrPeakAnalysis
...
After execution in psana the file.root
containing histogram(s) and ntuple(s) will be produced. Then, auxiliary script in root, running by the commend
root -q -f proc.C
produces the plots with histograms:
Example for TimeStampFilter and XtcOutputModule
This example demonstrates how to run psana with the time stamp filter and event writer in xtc file.
Both modules are available in psana library and they need only to be described in the configuration file. For example, the configuration file tstamp-filter-and-event-writer.cfg
may looks like:
...