Versions Compared

Key

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

Include Page
PageMenuBegin
PageMenuBegin
Table of Contents
Include Page
PageMenuEnd
PageMenuEnd

About

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.

...

Example of the output produced by this module:

Code Block
bgColor#F7F7ED

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:

Code Block
bgColor#F7F7ED

% psana -m EventKeys <input-files>

...

Example of the output produced by this module:

Code Block
bgColor#F7F7ED

[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)

...

Example of the output produced by this module with the default parameters (including output from PrintEventId module):

Code Block
bgColor#F7F7ED

[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)

...

To use this module with default parameters one could use this command:

Code Block
bgColor#F7F7ED

psana -m cspad_mod.CsPadPedestals input-files.xtc

...

To change module parameters one could create file with name psana.cfg in the current directory with a contents like this:

Code Block
bgColor#F7F7ED

[psana]
modules = cspad_mod.CsPadPedestals

[cspad_mod.CsPadPedestals]
source = DetInfo(CxiDs1.0:Cspad.0)
output = pedestals.dat
noise =

and then run psana:

Code Block
bgColor#F7F7ED

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.

...

To use this module with default parameters one could use this command:

Code Block
bgColor#F7F7ED

psana -m cspad_mod.CsPad2x2Pedestals input-files.xtc

...

To change module parameters one could create file with name psana.cfg in the current directory with a contents like this:

Code Block
bgColor#F7F7ED

[psana]
modules = cspad_mod.CsPad2x2Pedestals

[cspad_mod.CsPad2x2Pedestals]
source = DetInfo(CxiSc1.0:Cspad2x2.0)
output = pedestals.dat
noise =

and then run psana:

Code Block
bgColor#F7F7ED

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.

...

parameter

default value

description

calibDir

 

directory with calibration files, by default it is set to .../<experiment>/calib

typeGroupName

"CsPad::CalibV1"

calibration type and group names

source

"CxiDs1.0:Cspad.0"

source of data

key

 

key for data processing stage

imgkey

"image"

output key for image saved in event

tiltIsApplied

true

on/off for tilt angle of 2x1-sections and quads.

print_bits

0

verbosity:

  • =0 - print nothing,
  • +1 - input pars,
  • +2 - calib pars,
  • +4 - consumed time per event,
  • +8 - information about image saved in event.

...

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, CSPad2x2, 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 "cspad2x2-pix-spectra.txt.sha" outpuit file contains

Code Block
bgColor#F7F7ED

NPIXELS  143560
NBINS    100
AMIN     500
AMAX     1000
NEVENTS  2549
ARRFNAME cspad2x2-pix-spectra.txt

...

  1. If the first and/or last event numbers are defined, then the filter will select events in this range only.
  2. If the evtstring is defined, only listed events of event ranges will be selected. For example, the evtstringparameter can be defined as

    Code Block
    bgColor#F7F7ED
    
     2,5,11-15,20-25,29,30
    

    that means the list of events:

    Code Block
    bgColor#F7F7ED
    
      2  5  11  12  13  14  15  20  21  22  23  24  25  29  30
    

    In the 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.
    The filterIsOn allows easy turn on/off this filter in *.cfg file.

Module ImgAlgos::PnccdImageProducer

...

  • Gets acqiris configuration and data from Acqiris::ConfigV1 and Acqiris::DataDescV1, etc. objects using source and key_in;
  • produces ndarray<dtypendarray<double,2> object of shape[] = {nbrChannels, nbrSamples} for waveforms and times;
  • save configuration data in file defined by fname_prefix;
  • save waveforms in the event store with keys key_wform and key_wform.

parameter

default value

description

source

"DetInfo(:Acqiris)"

source of data

key_in 

"" (empty)

key for input data (raw - by default)

key_wform

"acq_wform"

output key for wave forms saved in event

key_outwform

"acqirisacq_wform"

output key for array saved in event

fname_prefix

""

file name prefix for configuration parameters

print_bits

0

verbosity:

  • =0 - print nothing
  • +1 - input parameters
  • +2 - configuration parameters
  • +4 - record about saving file with configuration parameters
  • +8 - print part of waveform for all channels and segments in each event

...

  • ImgCalib uses the 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,
  • gets the calibration parameters from files fname_peds, fname_bkgd, fname_gain, fname_mask, and fname_nrms, if their names are specified,
  • the specified by the file name corrections are applied per-pixel to raw data image as follows:

    Code Block
    bgColor#F7F7ED
    
    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
    
  • corrected image is saved in the event with key key_out as double type.

...

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:

Code Block
bgColor#F7F7ED

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}}
} ;

...

This module finds peaks in the ndarray<double,2> image object. Algorithm and the list of parameters are the same as described is section Psana Module ImgAlgos::CSPadArrPeakFinderCatalog. The only difference is that the image size is defined by the ndarray<double,2> object.

...

  • ImgHitFinder uses the 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,
  • gets the calibration parameters from files fname_peds, fname_gain, fname_mask, and fname_thre, if their names are specified,
  • the specified by the file name corrections are applied per-pixel to raw data image as follows:

    Code Block
    bgColor#F7F7ED
    
    A_cor = A_raw
            (1) - pedestal              | if the file name is specified in the parameter "fname_peds"
            (2) * gain                  | if the file name is specified in the parameter "fname_gain"
            (3) apply mask              | if the file name is specified in the parameter "fname_mask"
            (4) apply threshold         | if the file name is specified in the parameter "fname_thre"
    
  • corrected image is saved in the event with key key_out as double (or unsigned for pixel map) type.

...

  • <fname_prefix>-<fname-common>-b<block-number>.<file_type>
  • <fname_prefix>-<fname-common>-med.txt
  • <fname_prefix>-<fname-common>-time.txt
    is implemented in stand-alone c++ module

    Code Block
    bgColor#F7F7ED
    
    ImgAlgos/app/corana.cpp (or ImgAlgos/test/corana.cpp)
    
    Note

    Note, the application in the test directory is compiled and run by the commands:
    scons test
    <path>/corana -f <fname_data> -t <fname_tau>\ -h -l <logfile>\ -b <basedir>\

    where

  • <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.

...

  • saves counter number and the time records in file fname.
  • print summary parameters for parser, for example:

    Code Block
    bgColor#F7F7ED
    
    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
    

...

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:

Code Block
bgColor#F7F7ED

 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:

Code Block
bgColor#F7F7ED

IntensityMonitorsData: Summary for parser
BATCH_RUN_NUMBER              0020
BATCH_NUMBER_OF_EVENTS        75

...

Note

The shape of the CSPad array in the file bkgd_fname is [4*8*185][388] for all 2x1 sections.
The shape of the CSPad array in the event, specified by the source and inputKey or outputKey,
is [number_of_sections*188][388] depends on number of available in DAQ 2x1 sections, provided by the masks in CSPad configuration, for example:

Code Block
bgColor#F7F7ED

   shared_ptr<Psana::CsPad::ConfigV2> config2 = env.configStore().get(m_str_src);
   unsigned mask = config2->roiMask(quad_number); // should be in the range from 0 to 255

...

Is intended to print records showing job performance current and integrated from the beginning of job:

Code Block
bgColor#AAFFFF

py_img_algos.tahometer: run:0049  evt:000005  t[sec]:     2.575  dt[sec]:     2.575  n/t[1/sec]:     1.942  dn/dt[1/sec]:     1.942

...