Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • psana.cfg - set non-default parameters to run psana for ImgAlgos::ImgPeakFinder and ImgAlgos::ImgPeakFilter
    The psana 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.

Module ImgAlgos::CSPadArrAverage

Wiki Markup
This module averages the CSPad data array and saves two files for averaged and rms values in CSPad format \[5920=4*8*185\]\[388\]. In contrast to the [cspad_mod.CsPadPedestals|PCDS:Psana Module Catalog#Modulecspadmod.CsPadPedestals], the input data can be specified with a {{key}}, that allows to average CSPad array for already pre-processed data, for example {{"calibrated"}}. This feature can be used to evaluate the averaged signal or background event. Implemented algorithm of averaging allows to eliminate large statistical fluctuations in the pixel amplitude spectrum. In advanced case averaging may have up to three stages, depending on configuration parameters:

  • 0-stage: the 1st portion of events from 0 to evts_stage1 is averaged without any constrains, the preliminary averaged and rms values are defined for each pixel
    at the end of this stage.
  • 1-stage: starting from the event evts_stage1 data are collected only for abs(amplitude-average0) < gate_width1. At the end of this stage the preliminary averaged and rms values are defined for each pixel.
  • 2-stage: starting from the event evts_stage2 data are collected only for abs(amplitude-average1) < gate_width2. At the end of this stage the preliminary averaged and rms values are defined for each pixel and saved in the files specified by the avefile and rmsfile parameters, respectively.

This type of averaging algorithm may be useful for pedestal defenition in case of large amplitude fluctuations.

Module configuration parameters:

  • source (default: "DetInfo(:Cspad)") – input source of data
  • key (default: "") – key for input data, for example, it might be "calibrated"
  • avefile (default: "cspad-ave.dat") – out file with averaged amplitudes
  • rmsfile (default: "cspad-rms.dat") – out file with rms
  • evts_stage1 (default: 1<<31U) – number of events before stage 1
  • evts_stage2 (default: 100) – additional number of events before stage 2
  • gate_width1 (default: 0) – gate_width for stage 1
  • gate_width2 (default: 0) – gate_width for stage 2
  • print_bits (default: 0) – module verbosity:
    • 0 - print nothing,
    • 1 bit (1) - input pars,
    • 2 bit (2) - beginning of 3 stages,
    • 3 bit (4) - processed statistics at the end of each stage,
    • 4 bit (8) - output in files,
    • 5 bit (16) - event ID.

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