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.
Package psana
Psana package include several simple modules which do generic tasks that do not need knowledge of the event data types.
Module psana.EventKeys
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.
Module psana.PrintEventId
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 psana.PrintSeparator
This module prints separator line on every event. Can be used to indicate event boundaries in job's log.
Module has two configuration parameters:
separator
(default: "=") – separator stringrepeat
(default: 80) – number of repeats of separator string on a separator line
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)
Package psana_examples
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.
Module psana_examples.DumpAcqiris
Extracts and dumps the content of Acqiris configuration (Psana::Acqiris::ConfigV1
) and event data (Psana::Acqiris::DataDescV1
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Acqiris)") – data source address
Module psana_examples.DumpAcqTdc
Extracts and dumps the content of Acqiris TDC configuration (Psana::Acqiris::TdcConfigV1
) and event data (Psana::Acqiris::TdcDataV1
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:AcqTDC.0)") – data source address
Module psana_examples.DumpBld
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 has four configuration parameters:
eBeamSource
(default: "BldInfo(EBeam)") – data source address forPsana::Bld::BldDataEBeam
phaseCavSource
(default: "BldInfo(PhaseCavity)") – data source address forPsana::Bld::BldDataPhaseCavity
feeSource
(default: "BldInfo(FEEGasDetEnergy)") – data source address forPsana::Bld::BldDataFEEGasDetEnergy
ipimbSource
(default: "BldInfo(NH2-SB1-IPM-01)") – data source address forPsana::Bld::BldDataIpimb
Module psana_examples.DumpCamera
Extracts and dumps the content of camera configuration (Psana::Camera::FrameFexConfigV1
) and event data (Psana::Camera::FrameV1
and Psana::Camera::TwoDGaussianV1
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Opal1000)") – data source address
Module psana_examples.DumpControl
Extracts and dumps the content of scan control configuration (Psana::ControlData::ConfigV1
) object.
Module has one configuration parameter:
source
(default: "ProcInfo()") – data source address
Module psana_examples.DumpCsPad
Extracts and dumps the content of CsPad configuration (Psana::CsPad::ConfigV*
) and event data (Psana::CsPad::DataV*
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Cspad)") – data source address
Module psana_examples.DumpEncoder
Extracts and dumps the content of encoder configuration (Psana::Encoder::ConfigV1
) and event data (Psana::Encoder::DataV*
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Encoder)") – data source address
Module psana_examples.DumpEpics
Extracts and dumps the list of EPICS PVs and their values and status information on every event.
Module psana_examples.DumpEvr
Extracts and dumps the content of Evr configuration (Psana::EvrData::ConfigV*
and Psana::EvrData::IOConfigV1
) and event data (Psana::EvrData::DataV*
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Evr)") – data source address
Module psana_examples.DumpFccd
Extracts and dumps the content of FCCD configuration (Psana::FCCD::FccdConfigV*
) objects. To dump event data objects use psana_examples.DumpCamera module.
Module has one configuration parameter:
source
(default: "DetInfo(:Fccd)") – data source address
Module psana_examples.DumpIpimb
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 address
Module psana_examples.DumpLusi
Extracts 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 forPsana::Lusi::PimImageConfigV1
ipimbSource
(default: "DetInfo(:Ipimb)") – data source address for other data
Module psana_examples.DumpOpal1k
Extracts 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 address
Module psana_examples.DumpPnccd
Extracts 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 address
Module psana_examples.DumpPrinceton
Extracts 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 address
Module psana_examples.DumpPulnix
Extracts and dumps the content of Pulnix configuration (Psana::Pulnix::TM6740ConfigV*
) objects.
Module has one configuration parameter:
source
(default: "DetInfo(:Tm6740)") – data source address
Module psana_examples.EBeamHist
This 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 address
Package cspad_mod
Package cspad_mod contains common modules useful for analysis of data from CsPad detector.
Module cspad_mod.CsPadPedestals
This module is supposed to run on 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()") – 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 written
To 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.
Module cspad_mod.CsPadCalib
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 calculation
If 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.
The calibration is performed on every CsPad image 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 algorithm
Module cspad_mod.CsPadFilter
This 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 numbers
Parameter 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
Package CSPadPixCoords calculates the 2x1 section, quad, and CSPad pixel coordinates and produces the image.
For complete reference select Doxygen documentation.
Module CSPadPixCoords::PixCoordsTest
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.
Module CSPadPixCoords::CSPadImageProducer
CSPadImageProducer works in psana framework. It does a few operation as follows:
- gets the pixel coordinates from PixCoords2x1, PixCoordsQuad, and PixCoordsCSPad classes,
- gets data from the event,
- produces the Image2D object with CSPad image for each event,
- adds the Image2D object in the event for further modules.
Time consumed to fill the CSPad image array (currently 1750x1750) is measured to be about 40 msec/event on psana0105.
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,tiltIsApplied
(default: true) – on/off for tilt angle of 2x1-sections and quads.
Module CSPadPixCoords::CSPadInterpolImageProducer
CSPadImageProducer works in psana framework. It does a few operation as follows:
- gets the pixel coordinates from PixCoords2x1, PixCoordsQuad, and PixCoordsCSPad classes,
- makes the arrays of neighbour addresses (quad, section, row, column) and weights as a function of the bin indexes (ix, iy) of the CSPad image,
- gets data from the event,
- produces the Image2D object with interpolated CSPad image for each event,
- adds the Image2D object in the event for further modules.
In this module we use 4-node bi-linear interpolation algorithm.
Time consumed to fill the CSPad image array (currently 1750x1750) is measured to be about 200 msec/event on psana0106. We consider options for acceleration using GPU or multi-core processing.
Module configuration parameters are the same as for the CSPadPixCoords::CSPadImageProducer.
Module CSPadPixCoords::CSPadImageGetTest
CSPadImageGetTest is a psana module class, which works after CSPadImageProducer. It gets the Image2D object from the event. This image object may be used in data processing. For the test purpose, the image of particular event is saved in the text file. This event number is defined in the psana.cfg
configuration file.
Module configuration parameters:
source
(default: "CxiDs1.0:Cspad.0") – source of data,events
(default: 10000000) – number of events before stop a job,eventSave
(default: 32U) – event number to save the CSPad image file,filter
(default: false) – on/off for potential selection filter.
Package ImgPixSpectra
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. Axillary 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. The python scripts in ImgPixSpectra/data/
allow to plot content of the spectral array as a 2-d plot. For example, the command
ImgPixSpectra/data/PlotSpectralArrayFromFile.py mini-cspad-pix-spectra.txt
generates image for limited range of pixels for CSPad, MiniCSPad, or Camera, respectively:
For complete reference select Doxygen documentation
Module ImgPixSpectra::CSPadPixSpectra
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" ) – putput file name
Module ImgPixSpectra::MiniCSPadPixSpectra
The 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 MiniCSPad
Module ImgPixSpectra::CameraPixSpectra
The 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 camera
orsource
(default: "DetInfo(:Princeton)" ) – source of data for Princeton camera