Versions Compared

Key

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

...

  • gets the pixel coordinates from PixCoords2x1, PixCoordsQuad, and PixCoordsCSPad classes,
  • gets data from the event (from Psana::CsPad::DataV#, Psana::CsPad::ElementV# (where # stands for 1 or 2) data objects or  from ndarray<Tndarray<const T,3> of shape [N][185][388])
  • produces the ndarray<doublendarray<const double,2> or Image2D<double> object with CSPad image for each event,
  • adds the image object in the event for processing in other modules.
    Time consumed to fill the CSPad image array (currently 1750x1750) is measured to be about 40 msec/event on psana0105.
  • produces image size pixel map array where real/fake pixels are marked as 1/0, respectively. This array is saved in the env.calibStore() as ndarray<int16ndarray<const int16_t ,2> for source. If the file name fname_pixmap is not empty the map will be saved in this file in text format.
  • produces image size map of pixel indexes in the flatten [4][8][185][388] array where fake pixels are marked as -1. This array is saved in the env.calibStore() as ndarray<int32ndarray<const int32_t ,2> for source. If the file name fname_pixnum is not empty the map will be saved in this file in text format.

...

  • 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 ndarray<doublendarray<const double,2> or CSPadPixCoords::Image2D<double> object in the event for processing in other 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.

...

  • gets geometry alignment parameters center and tilt from /reg/d/psdm/<inst>/<experiment>/calib/... directory
  • gets the pixel coordinates from PixCoords2x1 and PixCoordsCSPad2x2 classes,
  • gets data from the event,
  • produces the Image2D<double> or ndarray<doublendarray<const double,2> object with CSPad image for each event,
  • adds the image object in the event for processing in other modules.
    The CSPad2x2 image array is currently shaped as (400,400).

...

  • By default the empty inkey corresponds to raw data.
  • If the 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<doublendarray<const double,2> object.

See also Example for Module CSPadPixCoords::CSPad2x2ImageProducer.

...

  • gets CSPAD configuration from the environment frame Psana::CsPad::ConfigV#,
  • gets CSPAD data from the event frames Psana::CsPad::DataV#, Psana::CsPad::ElementV#,
  • creates the data array as ndarray<Tndarray<const T,3>, where T stands for outtype, which may be double, float, int, or uint16,
  • puts the data array in the event with outkey tag.

The data array ndarray<Tndarray<const T,3> has a shape (N,185,388), where N≤32.
This array is combined from data arrays for quads, ndarray<int32ndarray<const int32_t,3> with shape (M,185,388), where M≤8, taking into account the CSPAD configuration.

...

  • gets CSPAD2x2 configuration from the environment frame Psana::CsPad2x2::ConfigV#,
  • gets CSPAD2x2 data from the event frames Psana::CsPad2x2::ElementV#,
  • creates the data array as ndarray<Tndarray<const T,3>, where T stands for outtype, which may be double, float, int, or uint16,
  • puts the data array in the event with outkey tag.

The data array ndarray<Tndarray<const T,3> has a shape (185,388,2).

...

  • gets Andor data from the event for specified source and key_in parameters,
  • puts the ndarray<doublendarray<const double,2> object with camera image in the event using specified key_out parameter.

parameter

default value

description

source

"DetInfo(:Andor)"

source of data

key_in

 

key for input data

key_out

"andorimg"

output key for image saved in event

outtype

"asdata"

out data type: implemented values: asdata (default, unsigned shortuint16_t), float, double, int and int16.

print_bits

0

verbosity:

  • =0 - print nothing
  • +1 - input pars
  • +2 - data from event()
  • +4 - configuration parameters
  • +8 - table with sizes of types

...

  • gets pnCCD data from Psana::PNCCD::FramesV1 object from the event for specified source and key_in parameters,
  • puts the ndarray<TOUTndarray<const TOUT,3> object of shape 4x512x512 specified key_out parameter.

...

  • gets from the event store the object with pnCCD data of type
    • Psana::PNCCD::FullFrameV1 containing four [512][512] frames with T=uint16_t, or
    • ndarray<Tndarray<const T,3> , where shape=[4][512][512], T=unsigned short, float, double, int, or int16,
    for specified source and inkey parameters
  • puts the ndarray<Tndarray<const T,2> object with pnccd [1024+gap_rows][1024+gap_cols] image in the event using specified outimgkey parameter.

...

  • gets any camera image data from the event for specified source and key_in parameters,
  • puts the ndarray<doublendarray<const double,2> object with camera image in the event using specified key_out parameter.

parameter

default value

description

source

"DetInfo(:Opal1000Camera)"

source of data

key_in

 

key for input data

key_out

"pnccdimg"

output key for image saved in event

outtype

"asdata"

out data type: implemented values: asdata (default, uint16_t), float, double, int and int16.

subtract_offset

true

on/off the amplitude offset using configuration data (not applied for outtype = asdata)

print_bits

0

verbosity:

  • =0 - print nothing
  • +1 - input pars
  • +2 - time stamp for each event
  • +4 - summary at the endJob
  • +8 - details about data format conversion and applied offset
  • +16 - configuration data for each beginCalibCycle

See also Example for Module ImgAlgos::CameraImageProducer.

...

  • gets the Princeton camera image data from event for specified source and key_in parameters,
  • puts the ndarray<uint16ndarray<const uint16_t,2> object with image in the event using specified key_out parameter.

...

  • Gets acqiris configuration and data from Acqiris::ConfigV1 and Acqiris::DataDescV1,  objects using parameters source and key_in;
  • produces ndarray<doublendarray<const double,2> of shape[] = {nbrChannels, nbrSamples} for waveforms and time stamps;
  • saves configuration data in the file defined by fname_prefix;
  • saves waveforms and time stamps in the event store with keys key_wform and key_wtime.

...

  • Gets Acqiris waveforms from event store as ndarray<double ndarray<const double,2> object using parameters source and key_in;
  • performs waveform selection controlled by parameters: thresholds, is_postive_signal, do_inverse_selection, in the range depending on local event numbers skip_events and proc_events;
  • after number of events proc_events or at the end of job (whatever happens first), saves array of averaged waveforms in the text file with name constructed from fname_ave_prefix and in the event store using parameters source and key_average.

...

  • Gets Acqiris waveforms from event store as ndarray<double ndarray<const double,2> object using parameters source and key_in;
  • processes events in the range depending on local event numbers skip_events and proc_events;
  • at the 1st processed event loads the fname_base_line file with baseline  ndarray<doublendarray<const double,2>;
  • subtract baseline from waveforms;
  • save corrected waveforms in the event store as ndarray<doublendarray<const double,2> object using parameters source and key_out.

...

  • Gets Acqiris waveforms from event store as ndarray<double ndarray<const double,2> object using parameters source, key_wform, key_wtime;
  • runs constant-fraction discriminator algorithm on all acqiris channels using user-specified per-channel parameters;
  • saves edges into the event as a set of ndarray<double,1>;

     

    parameter

    default value

    description

    source

    "DetInfo(:Acqiris)"

    Source of data.

    key_wform

    "acqiris_wform"

    Key for input ndarray with waveforms (either raw, or subtracted using AcqirisCalib module) from evt store.

    key_wtime

    "acqiris_wtime"

    Key for input ndarray with waveform times from evt store.

    key_edges

    "acqiris_edges_"

    Key for output ndarray<double,1> with calibrated waveforms. This key will have the acqiris channel number (1 thru 20) appended to the end of it, and the data for that channel will be added to the event only if edges were found.

    baselines

    ""

    A list of baseline values (one per channel) to subtract from the waveform in volts.

    fractions

    ""

    A list of fractions (one per channel) between 0 and 1. The edge-time reported will be at the time when the pulse is at this fraction of the peak value.

    thresholds

    ""

    A list of threshold values (one per channel) in volts that indicate a new edge should be found. If this value is less than the baseline, then the algorithm will look for negative pulses, otherwise it will look for positive pulses.

    deadtimes

    ""

    A list of deadtimes (one per channel) in seconds. After each edge the algorithm will ignore any new hits in this time interval.

    leading_edges

    ""

    A list of 0/1 values (one per channel) indicating whether edge-times are desired for leading edges (1) or falling edges (0).

...

This module averages over events the per-element data of the image array (ndarray<Tndarray<const T,NDim>, where T is implemented for almost all types: int, int16, uint, float, double etc., NDim≤5) and saves files for sum, averaged, rms values, mask, and, the hot pixel map. Input ndarray can be specified by the source and key parameters. Averaging may have up to three stages, depending on configuration parameters:

...

  • NDArrCalib uses the source and key_in parameters to get any ndarray<Tndarray<const T,NDIM> object from the event store, where T stands for uint16_t, int, float, uint8_t, or double, 1≤NDim≤5,
  • automaticly gets parameters from calibration store for types pedestals, common_mode, pixel_status, pixel_gain, and pixel_rms,
  • gets parameters from user-defined files fname_bkgd and  fname_mask, if their names are specified,
  • the specified by the do_... parameter corrections are applied to raw data  ndarray<Tndarray<const T,NDIM> as follows:

        1. subtracts pedestals,
        2. subtracts common mode,
        3. subtracts normalized background,
        4. apply gain factors,
        5. apply hot/bad pixel_status mask,
        6. apply mask, and
        7. apply threshold as a common low level,
        8. apply per-pixel threshold as N*RMS,
  • and saves the corrected ndarray<doublendarray<const double,NDim> in the event with key key_out

...

parameter

default value

description

source

DetInfo(:Camera)

source of data

key_in

 

key for input ndarray<Tndarray<const T,NDIM>

key_out

calibrated

output key for calibrated image saved in event

do_peds

false

true: pedestals subtracted if available in calib store

do_cmod

false

true: common mode correction is evaluated and applied

do_stat

false

true: bad/hot pixels in pixel_status are masked

do_mask

false

true: mask is applied if the file fname_mask is available

do_bkgd

false

true: normalized background is subtracted if the file fname_bkgd is available

do_gain

false

true: pixel_gain correction is applied if available in calib store

do_nrms

false

true: per-pixel threshold is applied if pixel_rms  is available in calib store

do_thre

false

true: low level threshold in ADU is applied

fname_bkgd

 

input file name for background, applied if the file name is specified

fname_mask

 

input file name for mask, applied if the file name is specified

masked_value

0.

intensity value (in ADU) substituted for masked pixels

threshold_nrms

3.

threshold as a number of sigmas to pixel_rms parameters

threshold

0.

common low level threshold in ADU

below_thre_value

0.

intensity substituted for pixels below threshold

bkgd_ind_min

0

minimal index in flatten ndarray, which is used for background normalization

bkgd_ind_max

100

maximal index in flatten ndarray, which is used for background normalization

bkgd_ind_inc

2

index increment in flatten ndarray, which is used for background normalization

print_bits

0

verbosity:

  • =0 - print nothing
  • +1 - input pars
  • +2 - calibration parameters
  • +4 - common mode algorithm parameters
  • +8 - ndarray parameters; type, ndim, shape, etc.
  • +16- time stamp for each event
  • +32 - first 10 elements of the raw image data
  • +64 - first 10 elements of the calibrated image data

...

This module averages over events the per-pixel data of the image array (ndarray<doublendarray<const 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:

...

This module gets the image data array (ndarray<Tndarray<const T,2>), where T stands for double, float, int, uint8_t, or uint16_t, and evaluates two masks:

...

  • ImgCalib uses the source and key_in parameters to get the input raw image (as ndarray<Tndarray<const 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.

...

  • ImgIntForBins uses the source and key_in parameters to get the input image (as ndarray<Tndarray<const T,2> object), where T stands for uint16_t, int, float, uint8_t, or double,
  • gets the pixel-bin indexes from files fname_map_bins, which has a size of image,
  • calculates average per pixel intensity for each of number_of_bins bin (from 0 to number_of_bins-1),
  • saves the 2-D array of <I>(event, bin) in file fname_int_bins.

...

  • The default key ("Image2D") stands for the CSPadPixCoords::Image2D<double> image object. Other key names work for the ndarray<doublendarray<const double,2> image object.
  • The xmin, xmax, ymin, ymax (in pixels) defines the window in the image for pixel counting. Default values means the entire image range.
  • The threshold, numPixMin, and the window extents have to be adjusted for particular experiment.

...

This module finds peaks in the ndarray<doublendarray<const 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<doublendarray<const double,2> object.

See also Example for Module ImgAlgos::ImgPeakFinderAB.

...

  • ImgHitFinder uses the source and key_in parameters to get the input raw image (as ndarray<Tndarray<const 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.

...

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:

  • gets the ndarray<doublendarray<const double,2> image object from event,
  • selects two spectral band regions and integrates amplitudes for each column (it is assumed that both spectra are oriented along the rows),
  • saves two spectral arrays for signal and reference bands and their relative difference as another ndarray<doublendarray<const double,2> object with shape (3,<number-of-columns>) in the event.
  • Further analytical work is assumed to be done in the next module ImgAlgos::ImgSpectraProc.

...

ImgSaveInFile works after the CSPadImageProducer, CSPadInterpolImageProducer, CameraImageProducer, PnccdImageProducer, etc., which produce image object in formats CSPadPixCoords::Image2D<T> or ndarray<Tndarray<const T,2>, where the T stands for one of the data types, double, float, int, uint8_t, or uint16_t.

...

  • get image for each event as an ndarray<Tndarray<const T,2> object,
  • splits it for nfiles_out equal parts,
  • saves each part of the image for all events in the job in a separate file with name <fname_prefix>-<fname-common>-b<block-number>.<file_type>,
  • saves metadata in the text file with name: <fname_prefix>-<fname-common>-med.txt,
  • saves counter number and the time records in file: <fname_prefix>-<fname-common>-time.txt.

...

  • ImgIntMonCorr uses the source and key_in parameters to get the input image (as ndarray<doublendarray<const double,2> object),
  • gets and process the intensity monitors' data in accordance with configuration from file fname_imon_cfg,
  • intensity normalized image is saved in the event with key key_out. The type of output data is the same as the type of input data.

...