This page provides a list of existing modules for psana framework. Only the modules that are included in the standard analysis releases appear on this page.
Psana package include several simple modules which do generic tasks that do not need knowledge of the event data types.
This module dumps the list of the event keys in the event or configuration store. Event key is a triplet of data type, data source address, and string key.
Example of the output produced by this module:
Event keys: EventKey(type=Psana::EvrData::DataV3, src=DetInfo(NoDetector.0:Evr.0)) EventKey(type=Psana::Camera::FrameV1, src=DetInfo(CxiDg1.0:Tm6740.0)) EventKey(type=Psana::Ipimb::DataV1, src=DetInfo(CxiDg1.0:Ipimb.0)) ... |
This module is useful to display the content of the events without dumping all the data. Example command which uses this module is:
% psana -m EventKeys <input-files> |
Note that one can specify EventKeys
instead of psana.EventKeys
as psana
package name is optional.
This module prints the content of the Event ID object on every event.
Example of the output produced by this module:
[info:psana.PrintEventId] event ID: XtcEventId(run=100, time=2010-12-12 11:09:36.300506429-08) [info:psana.PrintEventId] event ID: XtcEventId(run=100, time=2010-12-12 11:09:36.317163082-08) |
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"=" |
separator string |
|
80 |
number of repeats of separator string on |
This module prints separator line on every event. Can be used to indicate event boundaries in job's log.
Example of the output produced by this module with the default parameters (including output from PrintEventId module):
[info:/root/] ================================================================================ [info:psana.PrintEventId] event ID: XtcEventId(run=100, time=2010-12-12 11:09:36.300506429-08) [info:/root/] ================================================================================ [info:psana.PrintEventId] event ID: XtcEventId(run=100, time=2010-12-12 11:09:36.317163082-08) |
This package contains modules that are meant to be used as examples of accessing different data types or framework services. Can be used by developers as templates for new modules.
Extracts and dumps the content of Acqiris configuration (Psana::Acqiris::ConfigV1
) and event data (Psana::Acqiris::DataDescV1
) objects.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:Acqiris)" |
data source address |
Extracts and dumps the content of Acqiris TDC configuration (Psana::Acqiris::TdcConfigV1
) and event data (Psana::Acqiris::TdcDataV1
) objects.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:AcqTDC.0)" |
data source address |
Extracts and dumps the content of beamline data objects (Psana::Bld::BldDataEBeamV0
, Psana::Bld::BldDataEBeam
, Psana::Bld::BldDataPhaseCavity
, Psana::Bld::BldDataFEEGasDetEnergy
, and Psana::Bld::BldDataIpimb
).
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"BldInfo(EBeam)" |
data source address for |
|
"BldInfo(PhaseCavity)" |
data source address for |
|
"BldInfo(FEEGasDetEnergy)" |
data source address for |
|
"BldInfo(NH2-SB1-IPM-01)" |
data source address for |
Extracts and dumps the content of camera configuration (Psana::Camera::FrameFexConfigV1
) and event data (Psana::Camera::FrameV1
and Psana::Camera::TwoDGaussianV1
) objects.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:Opal1000)" |
data source address |
Extracts and dumps the content of scan control configuration (Psana::ControlData::ConfigV1
) object.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"ProcInfo()" |
data source address |
Extracts and dumps the content of CsPad configuration (Psana::CsPad::ConfigV*
) and event data (Psana::CsPad::DataV*
) objects.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:Cspad)" |
data source address |
Extracts and dumps the content of encoder configuration (Psana::Encoder::ConfigV1
) and event data (Psana::Encoder::DataV*
) objects.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:Encoder)" |
data source address |
Extracts and dumps the list of EPICS PVs and their values and status information on every event.
Extracts and dumps the content of Evr configuration (Psana::EvrData::ConfigV*
and Psana::EvrData::IOConfigV1
) and event data (Psana::EvrData::DataV*
) objects.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:Evr)" |
data source address |
Extracts and dumps the content of FCCD configuration (Psana::FCCD::FccdConfigV*
) objects. To dump event data objects use psana_examples.DumpCamera module.
Module configuration options:
parameter |
default value |
description |
---|---|---|
|
"DetInfo(:Fccd)" |
data source address |
Extracts and dumps the content of IPIMB configuration (Psana::Ipimb::ConfigV1
) and event data (Psana::Ipimb::DataV1
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Ipimb)") – data source addressExtracts and dumps the content of LUSI configuration (Psana::Lusi::DiodeFexConfigV1
, Psana::Lusi::IpmFexConfigV1
, and Psana::Lusi::PimImageConfigV1
) and event data (Psana::Lusi::DiodeFexV1
and Psana::Lusi::IpmFexV1
) objects.
Module has two configuration parameters:
tmSource
(default: "DetInfo(:Tm6740)") – data source address for Psana::Lusi::PimImageConfigV1
ipimbSource
(default: "DetInfo(:Ipimb)") – data source address for other dataExtracts and dumps the content of Opal1000 configuration (Psana::Opal1k::ConfigV1
) object. To dump event data objects use psana_examples.DumpCamera module.
Module has one configuration parameter:
source
(default: "DetInfo(:Opal1000)") – data source addressExtracts and dumps the content of pnCCD configuration (Psana::PNCCD::ConfigV*
) and event data (Psana::PNCCD::FrameV1
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:pnCCD)") – data source addressExtracts and dumps the content of Princeton configuration (Psana::Princeton::ConfigV1
) and event data (Psana::Princeton::FrameV1
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Princeton)") – data source addressExtracts and dumps the content of Pulnix configuration (Psana::Pulnix::TM6740ConfigV*
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Tm6740)") – data source addressThis module is an example of histogramming service usage. It extracts beam line data and fills couple of histograms with the beam parameters.
Module has one configuration parameter:
eBeamSource
(default: "BldInfo(EBeam)") – data source addressPackage cspad_mod contains common modules useful for analysis of data from CsPad detector.
This module is supposed to run on dark cspad2x2 frame data. It calculates average and standard deviation values for each pixel and writes these values to output files in text format.
Module configuration parameters:
source
(default: "DetInfo(:Cspad)") – name of the data source; default value is adequate if there is only one CsPad device in setup, if there is more than one device then more specific value should be providedoutput
(default: "cspad-pedestals.dat") – name of the output file for average values, if empty file will not be writtennoise
(default: "cspad-noise.dat") – name of the output file for standard deviation values, if empty file will not be writtenTo use this module with default parameters one could use this command:
psana -m cspad_mod.CsPadPedestals input-files.xtc |
which will produce files cspad-pedestals.dat
and cspad-noise.dat
in the current directory (if input file contains CsPad data).
To change module parameters one could create file with name psana.cfg
in the current directory with a contents like this:
[psana] modules = cspad_mod.CsPadPedestals [cspad_mod.CsPadPedestals] source = DetInfo(CxiDs1.0:Cspad.0) output = pedestals.dat noise = |
and then run psana:
psana input-files.xtc |
This should produce file pedestals.dat
in the current directory. As the source address is more specific this configuration file can be used even if input data contain more than one CsPad device.
This module is supposed to run on cspad2x2 dark frame data. It calculates average and standard deviation values for each pixel and writes these values to output files in text format.
Module configuration parameters:
source
(default: "DetInfo(:Cspad2x2)") – name of the data source; default value is adequate if there is only one CsPad2x2 device in setup, if there is more than one device then more specific value should be providedoutput
(default: "cspad2x2-pedestals.dat") – name of the output file for average values, if empty file will not be writtennoise
(default: "cspad2x2-noise.dat") – name of the output file for standard deviation values, if empty file will not be writtenTo use this module with default parameters one could use this command:
psana -m cspad_mod.CsPad2x2Pedestals input-files.xtc |
which will produce files cspad2x2-pedestals.dat
and cspad2x2-noise.dat
in the current directory (if input file contains CsPad2x2 data).
To change module parameters one could create file with name psana.cfg
in the current directory with a contents like this:
[psana] modules = cspad_mod.CsPad2x2Pedestals [cspad_mod.CsPad2x2Pedestals] source = DetInfo(CxiSc1.0:Cspad2x2.0) output = pedestals.dat noise = |
and then run psana:
psana input-files.xtc |
This should produce file pedestals.dat
in the current directory. As the source address is more specific this configuration file can be used even if input data contain more than one CsPad2x2 device.
This module performs standard CsPad calibration procedures: per-pixel pedestal subtraction and common mode correction. The algorithms used in calibrations are identical to translator algorithms, the result of calibration should be the same as the data stored in HDF5 files.
The module uses three input calibration files which should be located in the standard calibration directory of the corresponding experiment:
pedestals
– per-pixel pedestal data (produced by the CsPadPedestals module or standalone applications)pixel_status
– hot/dead status for every pixel, used by common mode algorithmcommon_mode
– file with parameters controlling common mode calculationpixel_gain
– per-pixel gain data, inverse pixel gain (1/gain) as floating numberIf any of the files is missing then corresponding algorithm is not executed, if pixel_status
file is missing then all pixels are assumed to have working status. Algorithms inside module are executed following this order:
The calibration is performed on every CsPad image (full or 2x2) found in the event and works even if there is more than one CsPad data object. The original objects are preserved in event and result of the calibration is stored in event with different string key ("calibrated" by default, can be changed with module parameter).
Module configuration parameters:
inputKey
(default is empty) – string key used to locate uncalibrated data objects in eventoutputKey
(default is "calibrated") – string key used to store calibrated data objects in eventdoPedestals
(default is "yes") – can be set to "no" to explicitly disable pedestal subtraction algorithmdoPixelStatus
(default is "yes") – can be set to "no" to explicitly disable reading of pixel status data, all pixels will be used for common modedoCommonMode
(default is "yes") – can be set to "no" to explicitly disable common mode algorithmdoPixelGain
(default is "yes") – can be set to "no" to explicitly disable pixel gain correction algorithmThis is a filter module which implements skipping for the events which have too low signal in CsPad. filtering algorithm can be controlled trough the module parameter and/or parameters in calibration file. The name of the calibration file is "filter" and it will be searched in the standard calibration directories of the experiment.
Module configuration parameters:
inputKey
(default is empty) – string key used to locate uncalibrated data objects in eventsource
(default is "DetInfo(:Cspad)") – data source addressskipIfNoData
(default is "yes") – when set to "yes" if the module does not find CsPad data in an event then it skips eventmode
(default is -1) – filtering mode, see belowparameters
(default is all 0) – list of parameters for filtering algorithm, up to 16 floating numbersParameter mode
defines where the filter get its parameters and how it works. If set to -1 (default) then it reads parameters and actual mode value from a calibration text file which should contain one integer number for mode and up to 16 floating point parameters. If parameter is set to 0 or if the value read from file is 0 then no filtering is done, all events are passed through. If mode is set to 1 (from parameter or file) then filter calculates the number of pixels above certain threshold. Filter expects two values in parameter array: threshold for pixel value and minimum number of pixels above threshold. If second parameter is negative then it's assumed to be a percentage of the full number of pixels.
Filter works on individual image arrays (quadrants). Module checks for CsPad::DataV1, CsPad::DataV2, and CsPad::MiniElementV1 objects in that order. If any object is found then module runs filter on images in that object. If any one image passes the filter then module returns and event is passed to downstream modules, otherwise framework skips this event.
With the default parameters module works with non-calibrated data, to switch to calibrated data add the module cspad_mod.CsPadCalib before filter and change inputKey
parameter to calibrated
.
Package CSPadPixCoords calculates the 2x1 section, quad, and CSPad pixel coordinates and produces the image.
For complete reference select Doxygen documentation.
This module demonstrates of how to use the PixCoords2x1, PixCoordsQuad, and PixCoordsCSPad classes
in order to pre-calculate pixel coordinates, taking into account the calibration parameters.
Relevant images are produced in combination of the pixel coordinates with event data and saved in text files.
Module configuration parameters:
calibDir
(default: "/reg/d/psdm/CXI/cxi35711/calib") – directory with calibration files,typeGroupName
(default: "CsPad::CalibV1") – data type and group names,source
(default: "CxiDs1.0:Cspad.0") – source of data,runNumber
(default: 32U) – run number for calibration file,events
(default: 32U) – number of events before stop a job,filter
(default: false) – on/off for potential selection filter.CSPadImageProducer works in psana framework. It does a few operation as follows:
ndarray<double,2>
or Image2D<double>
object with CSPad image for each event,Module configuration parameters:
calibDir
(default: "") – directory with calibration files, by default it is set to .../<experiment>/calibtypeGroupName
(default: "CsPad::CalibV1") – calibration type and group names,source
(default: "CxiDs1.0:Cspad.0") – source of data,key
(default: "") – key for data processing stage,imgkey
(default: "image") – output key for image saved in event,tiltIsApplied
(default: true) – on/off for tilt angle of 2x1-sections and quads.print_bits
(default: 0) – verbosity:
Remarks:
key
corresponds to raw data.imgkey
is defined as "Image2D", the image is saved in the event as a CSPadPixCoords::Image2D<double>
object, otherwise (by default) as a ndarray<double,2>
object.CSPadInterpolImageProducer works in psana framework. It does a few operation as follows:
ndarray<double,2>
or CSPadPixCoords::Image2D<double>
object in the event for processing in other modules.Module configuration parameters are the same as for the CSPadPixCoords::CSPadImageProducer.
CSPad2x2ImageProducer works in psana framework. It does a few operation as follows:
center
and tilt
from /reg/d/psdm/<inst>/<experiment>/calib/...
directoryImage2D<double>
or ndarray<double,2>
object with CSPad image for each event,Module configuration parameters:
calibDir
(default: "") – path to the calib
directory, if different from defaulttypeGroupName
(default: "CsPad2x2::CalibV1") – calibration software versionsource
(default: "DetInfo(:Cspad2x2.1)") – source of data,inkey
(default: "") – key for data processing stage,outimgkey
(default: "Image2D") – output key for image saved in event,tiltIsApplied
(default: true) – on/off for tilt angle of 2x1-sections and quads - currently is not used,print_bits
(default: 0) – verbosity:
Remarks:
inkey
corresponds to raw data.outimgkey
is defined as "Image2D", the image is saved in the event as a CSPadPixCoords::Image2D<double>
object, otherwise (for other names) as a ndarray<double,2>
object.See also Example for Module CSPadPixCoords::CSPad2x2ImageProducer.
CSPadNDArrProducer is a module for psana framework. It uses specified source
and inkey
parameters,
Psana::CsPad::ConfigV#
,Psana::CsPad::DataV#
, Psana::CsPad::ElementV#
,ndarray<T,3>
, where T stands for outtype
, which may be double, float, int, or uint16_t,outkey
tag.The data array ndarray<T,3>
has a shape (N,185,388), where N?32.
This array is combined from data arrays for quads, ndarray<int32_t,3>
with shape (M,185,388), where M?8, taking into account the CSPAD configuration.
In real data some 2x1 may be turned off, that can be seen in configuration object. |
Module configuration parameters:
source
(default: ":Cspad.0") – source of data,inkey
(default: "") – key for data processing stage,outkey
(default: "cspad_ndarr") – output key for image saved in event,outtype
(default: "float") – type of output data,print_bits
(default: 0) – verbosity:
For complete reference see the Doxygen documentation.
Package ImgPixSpectra is available since release |
Package ImgPixSpectra is intended to accumulate the spectra for all pixels of the image array.
Different modules of this package work with different data types for detectors like CSPad, mini-CSPad, Opal, Princeton camera, etc. All modules have the same interface and the same functionality.
In the loop over events from beginJob
to endJob
the image pixel amplitudes are accumulated in the 2-d array,
of the shape (<number-of-pixels>, <number-of-spectral-bins>). The first parameter is defined by the image size. The second is passed as an external parameter of the psana configuration file (psana.cfg
) along with minimal and maximal amplitudes. At the endJob
the spectral array is saved in file with specified name. Auxiliary file with the name extension *.sha
is created in order to save the shape parameters. For example, the "mini-cspad-pix-spectra.txt.sha" outpuit file contains
NPIXELS 143560 NBINS 100 AMIN 500 AMAX 1000 NEVENTS 2549 ARRFNAME mini-cspad-pix-spectra.txt |
This information can be used in analysis or presentation of this array.
Module configuration parameters:
source
(default: "CxiDs1.0:Cspad.0" ) – source of data for CSPadevents
(default: 1<<31U ) – number of events before stop a jobinputKey
(default: "" ) – input key for data processing stageamin
(default: 0. ) – minimal spectral amplitudeamax
(default: 1000. ) – maximal spectral amplitudenbins
(default: 100 ) – number of bins in spectraarr_fname
(default: "..._spectral_array.txt" ) – output file nameThe only difference in interface of this module from previous is in the default name for the source parameter and the output file name.
source
(default: "DetInfo(:Cspad2x2)" ) – source of data for MiniCSPadThe only difference in interface of this module from previous is in the default name for the source parameter and the output file name.
source
(default: "DetInfo(SxrBeamline.0:Opal1000.1)" ) – source of data for Opal camerasource
(default: "DetInfo(:Princeton)" ) – source of data for Princeton cameraSee also Example for Package ImgPixSpectra.
This packages contains a few psana
modules for analysis and image processing
This module measures the time interval for entire job and for each dn
events and prints the rate info as requested by the print_bits
parameter.
Module configuration parameters:
dn
(default: 100) – number of events between printoutprint_bits
(default: 2) – filter verbosity:
dn
events.See also Example for Module ImgAlgos::Tahometer.
This module passes only the events if their time stamp is in the requested range.
The range of allowed time stamps is defined by the configuration parameters.
Module configuration parameters:
tsinterval
(default: "1970-01-01 00:00:00.000000000 / 2100-01-01 00:00:00.000000000") – time-stamp interval stringtstamp_min
(default: "1970-01-01 00:00:00.000000000") – minimal time-stamp stringtstamp_max
(default: "2100-01-01 00:00:00.000000000") – maximal time-stamp stringfilterIsOn
(default: true) – On/Off the filterprint_bits
(default: 0) – filter verbosity:
The time-stamp string is accepted in various formats:
YYYYMMDD HHMMSS.FFF
YYYYMMDDTHHMMSS.F
YYYY-MM-DD HH:MM:SS.FFF
tsinterval
is defined and is different from the default, it will be used in filter and override the tstamp_min
and tstamp_max
.See also Example for TimeStampFilter and XtcOutputModule.
This filter selects events by their number counting from the beginning of job, starting from 0. The event number is not a parameter which is associated with event. Use this filter cautiously on your own risk for debugging purpose only.
The unique parameter associated with the event is a time-stamp. The event number is not defined in the xtc file and is not a recommended to use parameter. The events are counted locally inside this filter from the beginning of job starting from 0. Be cautious of using this filter in consecutive jobs for different runs! For example, this filter returns different subsets of events for the files with raw and selected events. |
Module configuration parameters:
filterIsOn
(default: true) – On/Off filter.first
(default: 0) – the first event from the beginning of job, starting from 0.last
(default: 1<<31) – the last event from the beginning of job.evtstring
(default: "") – the string of events of intervals from the beginning of job.print_bits
(default: 0) – filter verbosity:
There are two modes of operation of this filter.
first
and/or last
event numbers are defined, then the filter will select events in this range only.evtstring
is defined, only listed events of event ranges will be selected. For example, the evtstring
parameter can be defined as
2,5,11-15,20-25,29,30 |
2 5 11 12 13 14 15 20 21 22 23 24 25 29 30 |
evtstring
parameter the comma "," and sign minus "-" as a dash are the only allowed separators. Blank spaces are also allowed. Other characters may abort the program. The evtstring
mode has higher priority than the 1st mode.filterIsOn
allows easy turn on/off this filter in *.cfg
file.Functionality:
source
and inkey
parameters,ndarray<double,2>
object with pnccd 1024x1024 image in the event using specified outimgkey
parameter.Module configuration parameters:
source
(default: "DetInfo(:pnCCD)") – source of data,inkey
(default: "") – key for input data,outimgkey
(default: "pnccdimg") – output key for image saved in event,print_bits
(default: 0) – verbosity:
See also Example for Module ImgAlgos::PnccdImageProducer.
This module takes care about any generic camera image.
Functionality:
source
and key_in
parameters,ndarray<double,2>
object with camera image in the event using specified key_out
parameter.Module configuration parameters:
source
(default: "DetInfo(:Opal1000)") – source of data,key_in
(default: "") – key for input data,key_out
(default: "pnccdimg") – output key for image saved in event,subtract_offset
(default: true) – on/off the amplitude offset using configuration dataprint_bits
(default: 0) – verbosity:
See also Example for Module ImgAlgos::CameraImageProducer.
This module gets the Princeton camera image data and put it in the event as an image.
Functionality:
source
and key_in
parameters,ndarray<uint16_t,2>
object with image in the event using specified key_out
parameter.Module configuration parameters:
source
(default: "DetInfo(:Princeton)") – source of data,key_in
(default: "") – key for input data,key_out
(default: "image") – output key for image saved in event,print_bits
(default: 0) – verbosity:
See also Example for Module ImgAlgos::PrincetonImageProducer.
This module averages over events the per-pixel data of the image array (ndarray<double,2>) and saves files for averaged, rms values, and, if requested, the hot pixel mask. Input data can be specified by the source
and key
parameters. Averaging may have up to three stages, depending on configuration parameters:
evts_stage1
, the preliminary averaged and rms values are defined for each pixel at the end of this stage.evts_stage1
the pixel 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.evts_stage1 + evts_stage2
the pixel 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.Module configuration parameters:
source
(default: "DetInfo(:Opal1000")) – input source of datakey
(default: "") – key for input data, for example, it might be "calibrated"avefile
(default: "img-ave.dat") – out file with averaged amplitudesrmsfile
(default: "img-rms.dat") – out file with rmshotpix_mask
(default: "") – out file with hot pixel mask, saved if the name is not emptyhotpix_thr_adu
(default: "10000.") – threshold on rms (in ADU); if rms exceeds this threshold - pixel is hot.evts_stage1
(default: 1000000) – number of events before stage 1evts_stage2
(default: 0) – additional number of events before stage 2gate_width1
(default: 0) – gate_width for stage 1gate_width2
(default: 0) – gate_width for stage 2print_bits
(default: 0) – module verbosity:
Default parameters are set for regular single-stage averaging without any constrains.
See also Example for Module ImgAlgos::ImgAverage.
This module gets the image data array (ndarray<T,2>), where T stands for double, float, int, uint8_t, or uint16_t, and evaluates two masks:
In the endJob
this module saves files (if their names are provided) of image size for:
The S/N is estimated by averaging over neigbouring pixels.
Module configuration parameters:
source
(default: "DetInfo(:Opal1000")) – input source of data,key
(default: "") – key for input data, for example, it might be "calibrated",file_mask_satu
(default: "img-mask-satu.dat") – out file with saturated mask,file_mask_nois
(default: "img-mask-nois.dat") – out file with noise mask,file_mask_comb
(default: "img-mask-comb.dat") – out file with combined mask,file_frac_satu
(default: "img-frac-satu.dat") – out file with fraction of saturated events,file_frac_nois
(default: "img-frac-nois.dat") – out file with fraction of noisy events,thre_satu
(default: 1000000) – saturation-threshold (in ADU if the gain correction was not applied to image),frac_satu
(default: 0) – allowed fraction of saturated events,dr_SoN_ave
(default: 1) – radial size of the area for S/N evaluationthre_SoN
(default: 3) – noise-threshold ( in ADU if the gain correction was not applied to image),frac_nois
(default: 0.5) – allowed fraction of noisy events,print_bits
(default: 0) – module verbosity:
See also Example for Module ImgAlgos::ImgMaskEvaluation.
ImgCalib gets the raw image from data and process it as follows:
Functionality:
source
and key_in
parameters to get the input raw image (as ndarray<T,2>
object), where T stands for uint16_t, int, float, uint8_t, or double,fname_peds
, fname_bkgd
, fname_gain
, fname_mask
, and fname_nrms
, if their names are specified,A_cor = A_raw (1) - pedestal | if the file name is specified in the parameter "fname_peds" (2) - N*background | if the file name is specified in the parameter "fname_bkgd" (3) * gain | if the file name is specified in the parameter "fname_gain" (4) apply mask | if the file name is specified in the parameter "fname_mask" (5) apply N*RMS threshold | if the file name is specified in the parameter "fname_nrms" (6) apply threshold | if the "do_threshold" = true |
key_out
as double
type.Details:
bkgd_row_min
, bkgd_row_max
, bkgd_col_min
, and bkgd_col_max
. Normalization factor N
is evaluated for pixel amplitudes in this window as:N = sum(A_raw - pedestal) / sum(A_bkgd)
.fname_mask
file should be marked by '1' (ones) and bad pixels – by '0' (zeros). Mask is applied as a last correction. The bad masked pixel amplitudes are substituted by the masked_value
.Module configuration parameters:
source
(default: "DetInfo(:Camera)") – source of data,key_in
(default: "") – key for input image,key_out
(default: "calibrated") – output key for calibrated image saved in event,fname_peds
(default: "") – input file name for pedestals, applied if the file name is specified,fname_bkgd
(default: "") – input file name for background, applied if the file name is specified,fname_gain
(default: "") – input file name for gain, applied if the file name is specified,fname_mask
(default: "") – input file name for mask, applied if the file name is specified,fname_nrms
(default: "") – input file name for RMS, applied if the file name is specified,masked_value
(default: 0.) – amplitude value (in ADU) substituted for masked pixels,threshold_nrms
(default: 3.) – threshold as a number of sigmas from file fname_nrms
,threshold
(default: 0.) – constant low level threshold in ADU,below_thre_value
(default: 0.) – the amplitude substituted in pixels below threshold,do_threshold
(default:false) – if true - low level threshold
in ADU is applied,bkgd_row_min
(default: 0) – the window in image, which is used for background normalization,bkgd_row_max
(default: 10) – the window in image, which is used for background normalization,bkgd_col_min
(default: 0) – the window in image, which is used for background normalization,bkgd_col_max
(default: 10) – the window in image, which is used for background normalization,print_bits
(default: 0) – verbosity:
The pedestal, background, gain, mask, and N*RMS corrections are applied if associated file name is specified.
The constant low level threshold is applied if do_threshold
is true.
Corrections are not applied by default or with empty file names.
See also Example for Module ImgAlgos::ImgCalib.
Functionality:
source
and key_in
parameters to get the input image (as ndarray<T,2>
object), where T stands for uint16_t, int, float, uint8_t, or double,fname_map_bins
, which has a size of image,number_of_bins
bin (from 0 to number_of_bins-1
),fname_int_bins
.Module configuration parameters:
source
(default: "DetInfo(:Camera)") – source of data,key_in
(default: "") – key for input image,fname_map_bins
(default: "") – input file name for map of bin indexes,fname_int_bins
(default: "") – output file name for intensity(bin,event),number_of_bins
(default: 10) – number of bins for output intensities, if map has bins \>=number_of_bins
they will be ignored,print_bits
(default: 0) – verbosity:
This module averages the image pixel amplitude in r-phi bins, normalizes it per single pixel and subtracts the average amplitude from each pixel. Image is obtained from event by its source
and inkey
values. The output corrected image is saved in the event with outkey
keyword. Carthesian to polar coordinate transformation is done with respect to center coordinates xcenter
, ycenter
. The central region (r<rmin) and edges of the image (r>rmax) pixels can be removed from further consideration by setting rmin
and rmax
. The number of radial bins is defined as an int(rmax-rmin)
. The number of angular bins is set by n_phi_bins
.
Module configuration parameters:
source
(default: "DetInfo()") – input source of data,inkey
(default: " " ) – key for input data, by default use raw data,outkey
(default: "rad_corrected" ) – output key for further image processing,xcenter
(default: 850) – x coordinate of the image center,ycenter
(default: 850) – y coordinate of the image center,rmin
(default: 10) – radius minimal image is not processed for r<rmin,rmax
(default:1000) – radius maximal image is not processed for r>rmax,n_phi_bins
(default: 12) – number of angular sectors for the background averaging,event
(default: 0) – test event for print/save,print_bits
(default: 0) – module verbosity:
See also Example for Module ImgAlgos::ImgRadialCorrection.
The ImgAlgos::ImgPixAmpFilter is a filter for event selection.
This filter counts the number of image pixels in the specified window with amplitude exceeding the threshold
. If the number of high-amplitude pixels exceed the numPixMin
, the event is passed for further analysis.
The algorithm performance was tested for CSPad images. This algorithm consumes up to 15 ms/event on psana0205 for full CSPad (1650x1650) window size. For smaller window consumed time is negligible, comparing to the image reconstruction time, which is ~70 ms/event (for cspad_mod.CsPadCalib
and CSPadPixCoords::CSPadImageProducer
) on psana0205.
Module configuration parameters:
source
(default: "DetInfo(:Cspad)") – source of data,key
(default: "Image2D") – key for input image data,threshold
(default: 10) – minimal threshold on pixel amplitude,numPixMin
(default: 100) – minimal number of pixels with amplitude above the threshold,filterIsOn
(default: true) – On/Off the filter,xmin
(default: 0) – minimal column number,xmax
(default: 100000) – maximal column number,ymin
(default: 0) – minimal row number,ymax
(default: 100000) – maximal row number,print_bits
(default: 0) – verbosity:
Remarks:
key
("Image2D") stands for the CSPadPixCoords::Image2D<double>
image object. Other key
names work for the ndarray<double,2>
image object.xmin
, xmax
, ymin
, ymax
(in pixels) defines the window in the image for pixel counting. Default values means the entire image range.threshold
, numPixMin
, and the window extents have to be adjusted for particular experiment.This algorithm was motivated by users of amo42112:
1. Select the pixels in the window xmin
, xmax
, ymin
, ymax
with amplitudes above the threshold_low
.
2. Smear image for selected pixels, using 2-d matrix of weights over pixels
from -smear_radius
to +smear_radius
around each smeared pixel amplitude.
The matrix of weights is defined by the 2-d Gaussian function of width sigma
.
3. Find peaks as pixels with absolute-maximal amplitude above the threshold_high
in the center of the matrix -peak_radius
to +peak_radius
.
4. Put the vector of found peaks in the event with key peaksKey
. Each entry of this vector has an object of the struct Peak
, containing x, y positions, peak pixel amplitude, the total amplitude in the matrix, defined by the peak_radius
, and the number of pixels in the matrix above threshold_low
:
struct Peak{ double x; double y; double ampmax; // amplitude in the peak maximum double amptot; // total amplitude in the range of {{peak_radius}} unsigned npix; // number of pixels in the range of {{peak_radius}} } ; |
Module configuration parameters:
source
(default: "DetInfo()") – source of datakey
(default: "") – key for input image datapeaksKey
(default: "peaks") – key for output list of peaksthreshold_low
(default: 10) – low threshold on pixel amplitudethreshold_high
(default: 100) – high threshold on pixel amplitudesigma
(default: 1.5) – width of the Gaussian for smearing; =0-no smearingsmear_radius
(default: 3) – radius in pixel for smearing - radial size of matrix of weightspeak_radius
(default: 3) – radius in pixel for peak finding - radial size of the region to search for local maximumxmin
(default: 0) – minimal column numberxmax
(default: 100000) – maximal column numberymin
(default: 0) – minimal row numberymax
(default: 100000) – maximal row numbertestEvent
(default: 0) – event number to save images and print info for test purposefinderIsOn
(default: true) – On/Off algorithmprint_bits
(default: 0) – module verbosity:
Remarks:
See also Example for Module ImgAlgos::ImgPeakFinder.
This module use results and should work after the ImgAlgos::ImgPeakFinder. It gets the vector of peaks for the source
and key
, loops over all founded peaks and counts the number of peaks above the thresholds threshold_peak
and threshold_total
. If the selection_mode
is "SELECTION_ON" and the number of found peaks exceeds the n_peaks_min
the event is passed for further analysis/processing,
the table of found peaks may be saved in file with prefix defined by the fname
parameter.
Module configuration parameters:
source
(default: "DetInfo()") – source of datakey
(default: "peaks") – key for input list of peaks, should be the same as peaksKey
in ImgPeakFinder
selection_mode
(default: "SELECTION_ON") – three possible options:
threshold_peak
(default: 0) – threshold on peak amplitudethreshold_total
(default: 0) – threshold on total peak intensity (in the matrix around peak)n_peaks_min
(default: 1) – minimal number of peaks above all thresholdsfname
(default: "") – file name prefix; by default the prefix is empty and file is not savedprint_bits
(default: 0) – filter verbosity:
See also Example for Module ImgAlgos::ImgPeakFilter.
This module finds peaks in the ndarray<double,2>
image object. Algorithm and the list of parameters are the same as described is section Module ImgAlgos::CSPadArrPeakFinder. The only difference is that the image size is defined by the ndarray<double,2>
object.
See also Example for Module ImgAlgos::ImgPeakFinderAB.
This module is motivated by the discussion with Josef Frisch, Ryan Coffee, Nick Hartmann. In xppi0412 etc. experiments they need to extract two spectra from Opal1000 camera image for signal and reference, evaluate their relative difference, and find peak position in the differential spectrum.
Module mgAlgos::ImgSpectra
works as follows:
ndarray<double,2>
image object from event,ndarray<double,2>
object with shape (3,<number-of-columns>) in the event.Module configuration parameters:
source
(default: "DetInfo(:Opal1000)") – source of datakey_in
(default: "img") – key for input image datakey_out
(default: "spectra") – key for output array with spectrasig_band_rowc
(default: 510) – signal band central row at column=0ref_band_rowc
(default: 550) – reference ...sig_band_tilt
(default: 0) – signal band tilt angleref_band_tilt
(default: 0) – reference ...sig_band_width
(default: 10) – signal band width in number op rowsref_band_width
(default: 10) – reference ...print_bits
(default: 0) – module verbosity:
See also Example for Module ImgAlgos::ImgSpectra.
Works after module ImgAlgos::ImgSpectra.
This module is designed as an example, in order to show how to get access to spectral array.
In particular, method ImgSpectraProc::getSpectra(...)
shows how to get pointer to data, and method ImgSpectraProc::printSpectra(...)
iterates over array and selectively prints its elements.
Module configuration parameters:
source
(default: "DetInfo(:Opal1000)") – source of datakey_in
(default: "spectra") – key for input image dataprint_bits
(default: 0) – module verbosity:
See also Example for Module ImgAlgos::ImgSpectraProc.
Aka depricated modules: CSPadPixCoords::CSPadImageGetTest, CSPadPixCoords::SaveImageInFile, and ImgAlgos::SaveImageInFile. |
Module ImgSaveInFile receives from the event the image object using source
and key
parameters and saves it in the ftype
format with prefix file name fname
for event(s) specified by the parameters eventSave
or saveAll
. Currently implemented file formats: txt
, bin
, tiff
, and png
.
ImgSaveInFile works after the CSPadImageProducer, CSPadInterpolImageProducer, CameraImageProducer, PnccdImageProducer, etc., which produce image object in formats CSPadPixCoords::Image2D<T>
or ndarray<T,2>
, where the T
stands for one of the data types, double, float, int, uint8_t, or uint16_t.
Module configuration parameters:
source
(default: "CxiDs1.0:Cspad.0") – source of data,key
(default: "Image2D") – input image key,eventSave
(default: 0) – event number to save the CSPad image file,saveAll
(default: false) – save or not all selected events,ftype
(default: "txt") – output file format; currently implemented formats txt
, bin
, png
, tiff
fname
(default: "img") – prefix of the output file name. Entire file name<cspad_image_ev><timestamp>.<ftype>
.print_bits
(default: 0) – verbosity:
Saving in PNG currently works for uint8_t and uint16_t formats only... |
See also Example for Module ImgAlgos::ImgSaveInFile.
This module is a part of complex algorithm, described in Command Line Interface For Time Correlation Analysis.
This module is designed for parallel image processing for correlation analysis.
Functionality:
ndarray<T,2>
object,nfiles_out
equal parts,<fname_prefix>-<fname-common>-b<block-number>.<file_type>
,<fname_prefix>-<fname-common>-med.txt
,<fname_prefix>-<fname-common>-time.txt
.Module configuration parameters:
source
(default: "DetInfo(:Princeton)") – source of data,key
(default: "img") – input image key,fname_prefix
(default: "my-exp") – output files common prefix,file_type
(default: "bin") – output files type: "bin", "txt",add_tstamp
(default: true) – add time stamp to the output file names,nfiles_out
(default: 8 ) – number of output files (or number of parts to split image), it works tested and works for nfiles_out < 1016
,ampl_thr
(default: 1 ) – pixel amplitude threshold in image amplitude units,ampl_min
(default: 1 ) – default pixel amplitude if it is below ampl_min
,print_bits
(default: 0 ) – verbosity:
See also Example for Module ImgAlgos::ImgVsTimeSplitInFiles.
Further processing of the files
<fname_prefix>-<fname-common>-b<block-number>.<file_type>
<fname_prefix>-<fname-common>-med.txt
<fname_prefix>-<fname-common>-time.txt
ImgAlgos/app/corana.cpp (or ImgAlgos/test/corana.cpp) |
Note, the application in the |
<fname_data>
is one of the data files: <fname_prefix>-<fname-common>-b<block-number>.<file_type>
, which needs to be available;<fname_tau>
is a file with a list of indexes of tau for evaluation of correlations. By default or if the file is missing, the list of indexes will be generated automatically, and for book-keeping is saved in the file <fname_prefix>-<fname-common>-tau.txt
;<basedir>
is a directory for all data files, which is current by default;<logfile>
is an output log-file, or standard output by default.This module is reduced from ImgAlgos::ImgVsTimeSplitInFiles.
Functionality is restricted to:
fname
.ImgTimeStampList: Summary for parser BATCH_RUN_NUMBER 0020 BATCH_NUMBER_OF_EVENTS 75 BATCH_FRAME_TIME_INTERVAL_AVE 8.086934 BATCH_FRAME_TIME_INTERVAL_RMS 0.120381 BATCH_FRAME_TIME_INDEX_MAX 74 |
Module configuration parameters:
fname
(default: "tstamp-list.txt") – output files common prefix,print_bits
(default: 0 ) – verbosity:
This module is intended for CorAna
project.
ImgIntMonCorr gets the image and intensity monitor data, evaluate the normalization factor, applies this factor to the image intensity, and saves the corrected image in the event.
Functionality:
source
and key_in
parameters to get the input image (as ndarray<double,2>
object),fname_imon_cfg
,key_out
. The type of output data is the same as the type of input data.Module configuration parameters:
source
(default: "DetInfo(:Camera)") – source of data,key_in
(default: "calibrated") – key for input image,key_out
(default: "imon_corrected") – key for output calibrated image saved in event,fname_imon_cfg
(default: "") – input file name with intensity monitors' configuration,print_bits
(default: 0) – verbosity:
fname_imon_cfg
file content per line: source name, short name, on/off bits for 4-channels, normalization and selection, minimal, maximal and averaged intensities:
BldInfo(FEEGasDetEnergy) FEEGasDetEnergy 1 1 1 1 0 1 3.000000 7.500000 5.250000 BldInfo(XCS-IPM-02) XCS-IPM-02 1 1 1 0 1 0 10.000000 13.000000 11.500000 BldInfo(XCS-IPM-mono) XCS-IPM-mono 1 1 1 0 0 1 14.500000 16.000000 15.250000 DetInfo(XcsBeamline.1:Ipimb.4) Ipimb.4 1 1 1 1 0 0 -1.000000 -1.000000 1.000000 DetInfo(XcsBeamline.1:Ipimb.5) Ipimb.5 1 1 1 1 0 0 -1.000000 -1.000000 1.000000 |
This module is intended for CorAna
project.
It gets the 5 intensity monitors data (4 channels for each) and saves them in the text or binary file file_data
. Comments (or header) for this file is saved separately in file_header
. It also prints the summary parameters for parser, for example:
IntensityMonitorsData: Summary for parser BATCH_RUN_NUMBER 0020 BATCH_NUMBER_OF_EVENTS 75 |
Module configuration parameters:
imon1
(default: "BldInfo(FEEGasDetEnergy)" – source name for intensity monitor,imon2
(default: "BldInfo(XCS-IPM-02)") – source name for intensity monitor,imon3
(default: "BldInfo(XCS-IPM-mono)") – source name for intensity monitor,imon4
(default: "DetInfo(XcsBeamline.1:Ipimb.4)") – source name for intensity monitor,imon5
(default: "DetInfo(XcsBeamline.1:Ipimb.5)") – source name for intensity monitor,file_type
(default: "txt"); – file type may be "txt" or "bin",file_data
(default: "intensity-monitor-data.txt") – file name for data from intensity monitors,file_header
(default: "intensity-monitor-comments.txt") – file name for comments,print_bits
(default: 0 ) – verbosity:
This module saves the CSPad data array formatted as \[5920=4*8*185\]\[388\] in output file for each passes event. Module configuration parameters: |
source
(default: "DetInfo(:Cspad)") – input source of datakey
(default: "") – key for input data, for example, it might be "calibrated"outfile
(default: "cspad-arr") – out file name prefix for saved arrayprint_bits
(default: 0) – module verbosity:
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|PSDM: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: |
evts_stage1
is averaged without any constrains, the preliminary averaged and rms values are defined for each pixelevts_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.evts_stage1 + 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 datakey
(default: "") – key for input data, for example, it might be "calibrated"avefile
(default: "cspad-ave.dat") – out file with averaged amplitudesrmsfile
(default: "cspad-rms.dat") – out file with rmsevts_stage1
(default: 1<<31U) – number of events before stage 1evts_stage2
(default: 100) – additional number of events before stage 2gate_width1
(default: 0) – gate_width for stage 1gate_width2
(default: 0) – gate_width for stage 2print_bits
(default: 0) – module verbosity:
Default version of the configuration parameters works the same way as cspad_mod.CsPadPedestals. In this case module gets raw events and stage 0 continues for entire input data sample.
See also Example for Module ImgAlgos::CSPadArrAverage.
Alternative to the cspad_mod.CsPadCalib
algorithm for the common mode correction.
Takes the CSPad data array with subtracted pedestals, evaluate the average amplitude for each 2x1 section for amplitudes below the threshold, and subtract it from all pixel amplitudes. This algorithm consumes about 30 ms/event on psana0205.
Module configuration parameters:
source
(default: "DetInfo(:Cspad)" ) – source of data for CSPadinputKey
(default: "calibrated" ) – key for input data, by default expects data from cspad_mod.CsPadCalib
outputKey
(default: "cm_subtracted" ) – output key for the next data processing stageampthr
(default: 30 ) – threshold to exclude the large pixel amplitudes in averageThis module uses the CSPad array, specified by the configuration parameters source
and inputKey
, subtracts the background, defined in the file bkgd_fname
, and saves the resulting array in the event with outputKey
. The subtracted background array is normalized on the sum of pixel amplitudes in the quad section norm_sector
, which can be set from 0 to 7.
|
Module configuration parameters:
source
(default: "DetInfo(:Cspad)") – input source of datainputKey
(default: " " ) – key for input data, by default use raw dataoutputKey
(default: "bkgd_subtracted" ) – output key for the next data processing stage{{bkgd_fname}} (default: "cspad_background.dat" ) -- file with CSPad array \[4*8*185\]\[388\] of averaged background |
norm_sector
(default: 0) – CSPad sector in quad from 0 to 7print_bits
(default: 0) – module verbosity:
See also Example for Module ImgAlgos::CSPadBkgdSubtract.
This module uses the CSPad array, defined by the configuration parameters source
and inkey
, apply the mask from file mask_fnname
and saves the masked data with key outkey
. For masked pixels the amplitude will be replaced by the value from masked_amp
.
The file {{mask_fnname}} has the same structure as files for pedestals and background with dimensions \[4*8*185\]\[388\]. Masked pixels are indicated by 0-th in this file. This file can be generated, for example, from the averaged background file, using amplitude threshold. This can be done with auxiliary python script {{MakePixelMask.py}} as explained in [Example for Module ImgAlgos::CSPadMaskApply|PSDM:Psana Module Examples#Example for Module ImgAlgos::CSPadMaskApply]. |
Module configuration parameters:
source
(default: "DetInfo(:Cspad)" ) – input source of datainkey
(default: " " ) – key for input data, by default use raw dataoutkey
(default: "bkgd_subtracted" ) – output key for the next data processing stage{{mask_fname}} (default: "cspad_mask.dat" ) -- file with CSPad mask array \[4*8*185\]\[388\] |
masked_amp
(default: 0) – this amplitude will replace the amplitude in each masked pixelmask_control_bits
(default: 1) – control bits for applied mask:
print_bits
(default: 0) – module verbosity:
This module works on CSPad data array shaped as \[5920=4*8*185\]\[388\], uses the "median algorithm" to evaluate the signal and noise for each pixel, evaluates S/N ratio for each pixel, counts the fraction of events where {{S/N > SoNThr}}, and writes the same shape arrays for pixel mask and status information in the {{maskfile}} and {{statusfile}}, respectively. The {{statusfile}} contains for each pixel the fraction of events where {{S/N > SoNThr}}. This module presents a part of features implemented in the module [ImgAlgos::CSPadArrPeakFinder|PSDM:Psana Module Catalog#Module ImgAlgos::CSPadArrPeakFinder]. |
Module configuration parameters:
source
(default: "DetInfo(:Cspad)") – input source of datakey
(default: "") – key for input data, for example, it might be "calibrated"statusfile
(default: "cspad-pix-status.dat") – out file with pixel status: fraction of noisy imagesmaskfile
(default: "cspad-pix-mask.dat") – out file with pixel maskrmin
(default: 3) – radial parameter of the area for median algorithmdr
(default: 1) – radial band width of the area for median algorithmSoNThr
(default: 3) – S/N threshold for each pixel to be considered as noisyfrac_noisy_img
(default: 0.1) – fraction of noisy images above which pixel is masked in the maskfile
print_bits
(default: 0) – module verbosity:
See also Example for Module ImgAlgos::CSPadArrNoise.
Module {{ImgAlgos::CSPadArrPeakFinder}} is a psana-based implementation of the "median algorithm" for peak finding in CSPad data array shaped as \[5920=4*8*185\]\[388\]. This algorithm was first implemented in [myana|PCDS:myana user guide]/[Cheetah|https://github.com/antonbarty/cheetah] by Anton Barty and Co. The "median algorithm" assumes that the amplitude level of background and noise for each pixel can be estimated as a mean and RMS of the surrounding pixels, located in the ring with parameters {{rmin}} and {{dr}} around the pixel in question. The threshold {{SoNThr_noise}} on signal over noise (S/N) ratio allow to asset the pixel amplitude as a large noise fluctuation. Statistics of pixels above the S/N threshold accumulated over many images can be used to form the noisy-pixel mask. For example, if the fraction of images where pixel exceeds the S/N threshold grater than certain value ({{frac_noisy_imgs}}=0.9), the pixel is considered as noisy. The permanent bad pixel mask (see module [ImgAlgos::CSPadMaskApply|PSDM:Psana Module Catalog#Module ImgAlgos::CSPadMaskApply]) and dynamically evaluated noisy pixel mask are used to get rid of bad pixels and improve the image quality. Healthy pixels with S/N above threshold ({{SoNThr_signal}} about 3-5) are treated as potential signals. Using recursive flood-filling algorithm the groups of connected signal pixels can be found and considered as a candidate for a diffraction peaks. Peak finding algorithm uses the amplitude, S/N thresholds, and limits on number of pixels in the connected region (parameters {{peak_amp_tot_thr}}, {{peak_SoN_thr}}, {{peak_npix_min}}, and {{peak_npix_max}}) in order to define the peak. Finally, the event is selected or discarded depending on number of found peaks and total amplitude threshold, defined by the parameters {{event_npeak_min}}, {{event_npeak_max}}, and {{event_amp_tot_thr}}, respectively. |
Description of implemented algorithm:
beginJob(...)
method:
hot_pix_mask_file
(if its name is specified in the configuration file),event(...)
method the main part of "median algorithm" is implemented:
fill \[4\]\[8\]\[185\]\[388\] per-pixel arrays: |
m_stat
- number of events with |S/N| > SoNThr
,m_signal
- signal amplitude, or 0(zero) for masked pixels,m_proc_status
- sets 255 for S/N > SoNThr
or 0(zero) for masked pixels.m_proc_status
and m_signal
to find peaks:
iterate over \[185\]\[388\] 2x1 pixels and find the connected regions (using recursive flood-filling algorithm) |
v_peaks
of struct Peak
, using peak_npix_min
, peak_npix_max
, and peak_amp_tot_thr
parameters,v_peaks
, count total amplitude and the number of peaks in the event.event_npeak_min
, event_amp_tot_thr
, and selection_mode
parameters.m_stat
array and frac_noisy_imgs
parameter. When to start and for how many events to update the mask is defined by the nevents_mask_update
and nevents_mask_accum
parameters, respectively.m_signal
in file for selected events, depending on out_file_bits
parameter.v_peaks
in the evt with key=key_peaks_out
.endJob(...)
method, depending on bit status in out_file_bits
:
hot_pix_mask_out_file
frac_noisy_evts_file
Module configuration parameters:
source
(default: "DetInfo(:Cspad)") – input source of datakey
(default: "") – key for input data, for example, it might be "calibrated"key_signal_out
(default: "") – key for output signal array. If the string non-empty, the array is added in the datagram for each event (before selection).key_peaks_out
(default: "peaks") – key for vector of found peaks in the selected eventhot_pix_mask_inp_file
(default: "cspad-pix-mask-in.dat") – in read the pixel mask from filehot_pix_mask_out_file
(default: "cspad-pix-mask-out.dat") – out write current pixel mask in the filefrac_noisy_evts_file
(default: "cspad-pix-frac-out.dat") – out file with per-pixel fraction of noisy imagesevt_file_out
(default: "./cspad-ev-") – out file with signal CSPad array. Time stamp is added.rmin
(default: 3) – radial parameter of the area for median algorithmdr
(default: 1) – radial band width of the area for median algorithmSoNThr_noise
(default: 3) – S/N threshold for each pixel to be considered as noisySoNThr_signal
(default: 5) – S/N threshold for each pixel to be considered as noisyfrac_noisy_imgs
(default: 0.9) – fraction of noisy images above which pixel will be maskedpeak_npix_min
(default: 4) – minimal number of connected pixels for the good peakpeak_npix_max
(default: 25) – maximal number of connected pixels for the good peakpeak_amp_tot_thr
(default: 0.) – threshold on total signal amplitude of the group of connected pixels, if =0:OFFpeak_SoN_thr
(default: 7.) – threshold on peak S/N (S and N are sums over connected pixels)event_npeak_min
(default: 10) – threshold on minimal number of good peaks for the event selectionevent_npeak_max
(default: 10000) – threshold on maximal number of good peaks for the event selectionevent_amp_tot_thr
(default: 0.) – threshold on total signal amplitude in ADU of all good peaks for the event selection, if =0:OFFnevents_mask_update
(default: 0) – number of skipped events before each mask re-evaluation cyclenevents_mask_accum
(default: 50) – number of events for the mask re-evaluationselection_mode
(default: SELECTION_ON) – selection mode, other allowed values are: SELECTION_OFF, or SELECTION_INVout_file_bits
(default: 0) – control on writting of files:
hot_pix_mask_out_file
file with current mask array in the endJob(...)
method.frac_noisy_evts_file
file with current fraction of noisy events array in the endJob(...)
method.<evt_file_out>
<counter>
<run>-<time stamp>.txt.<evt_file_out>
<counter>
<run>-<time-stamp>-peaks.txt.print_bits
(default: 0) – module verbosity:
endJob
,beginJob
),beginJob
),npix>peak_npix_min-2
(otherwise too much junk output).See also Example for Module ImgAlgos::CSPadArrPeakFinder.
This module is intended for analysis of the results obtained in the peak finding algorithm implemented in the ImgAlgos::CSPadArrPeakFinder
module.
key
parameter,fname_root
parameter.Module configuration parameters:
source
(default: "DetInfo(:Cspad)") – input source of datakey
(default: "peaks") – key for input data for peaks found in eventfname_root
(default: "file.root") – name of the output file with root histograms and ntuplesprint_bits
(default: 0) – module verbosity:
beginJob
),endJob
),event
),event
).See also Example for Module ImgAlgos::CSPadArrPeakAnalysis.