Versions Compared

Key

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

...

  • dn (default: 100) – number of events between printout
  • print_bits (default: 2) – filter verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - start notice and summary at stop,
    • +4 - instant rate performance after each dn events.

Module ImgAlgos::

...

TimeStampFilter

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:

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 string
  • tstamp_min (default: "1970-01-01 00:00:00.000000000") – minimal time-stamp string
  • tstamp_max (default: "2100-01-01 00:00:00.000000000") – maximal time-stamp string
  • filterIsOn (default: true) – On/Off the filter
  • print_bits (default: 0) – filter verbosity:
    • =0 - print nothing,
    • +1 - input pars,
  • 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:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - event ID,
    • +8 - info about input image type (ndarray<double,2> or Image2D<double>).

See also Example for Module ImgAlgos::ImgRadialCorrection.

Module ImgAlgos::ImgPixAmpFilter

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:

...

    • time stamp variables for selected event.

The time-stamp string is accepted in various formats:

  • YYYYMMDD HHMMSS.FFF
  • YYYYMMDDTHHMMSS.F
  • YYYY-MM-DD HH:MM:SS.FFF
    but the date field has to be presented mandatory.
    If the 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.

Module ImgAlgos::EventNumberFilter

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.

Note

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 the filter.xmin
  • first (default: 0) – minimal column numberxmax the first event from the beginning of job, starting from 0.
  • last (default: 1000001<<31) – maximal column numberymin the last event from the beginning of job.
  • evtstring (default: 0) – minimal row numberymax (default: 100000) – maximal row number"") – the string of events of intervals from the beginning of job.
  • print_bits (default: 0) – filter verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - per selected event number of pixels above the threshold,
    • +8 - the same as previous, but for each 100's event,
    • +16 - event ID.

Remarks:

  • The default key ("Image2D") stands for the CSPadPixCoords::Image2D<double> image object. Other key names work for the ndarray<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.

Module ImgAlgos::ImgPeakFinder

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:

...

    • and ID.

There are two modes of operation of this filter.

  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 evtstring parameter can be defined as
    Code Block
    
     2,5,11-15,20-25,29,30
    
    that means the list of events:
    Code Block
    
      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

Functionality:

  • gets the pnccd data from the event, based on specified source and inkey parameters,
  • puts the 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:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - initial portion of pnccd array,
    • +4 - configuration pars.

See also Example for Module ImgAlgos::PnccdImageProducer.

Module ImgAlgos::CameraImageProducer

This module takes care about any generic camera image.
Functionality:

  • gets any camera image data from the event, based on specified source and key_in parameters,
  • puts the 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 data
  • print_bits (default: 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.

See also Example for Module ImgAlgos::PnccdImageProducer.

Module ImgAlgos::ImgRadialCorrection

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:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - event ID,
    • +8 - info about input image type (ndarray<double,2> or Image2D<double>).

See also Example for Module ImgAlgos::ImgRadialCorrection.

Module ImgAlgos::ImgPixAmpFilter

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 datapeaksKey (default: "peaks") – key for output list of peaks
  • threshold_low (default: 10) – low minimal threshold on pixel amplitudethreshold_high
  • numPixMin (default: 100) – high threshold on pixel amplitude
  • sigma (default: 1.5) – width of the Gaussian for smearing; =0-no smearing
  • smear_radius (default: 3) – radius in pixel for smearing - radial size of matrix of weights
  • minimal number of pixels with amplitude above the threshold
  • filterIsOn (default: true) – On/Off the filterpeak_radius (default: 3) – radius in pixel for peak finding - radial size of the region to search for local maximum
  • xmin (default: 0) – minimal column number
  • xmax (default: 100000) – maximal column number
  • ymin (default: 0) – minimal row number
  • ymax (default: 100000) – maximal row numbertestEvent (default: 0) – event number to save images and print info for test purposefinderIsOn (default: true) – On/Off algorithm
  • print_bits (default: 0) – finder verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - per event number of peaks in pixels above the eventthreshold,
    • +8 - per event each peak parameters,
    • +16- info about input image format.

Remarks:

  • This algorithm consumes ~15 ms/event on psana0101 for full Opal1000 (1024x1024) camera image.
  • Smearing algorithm use a "safety margin" which is currently set to 10 pixels (offset from each boarder of the full image size).

See also Example for Module ImgAlgos::ImgPeakFinder.

Module ImgAlgos::ImgPeakFilter

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 data
  • key (default: "peaks") – key for input list of peaks, should be the same as peaksKey in ImgPeakFinder
  • selection_mode (default: "SELECTION_ON") – three possible options:
    • SELECTION_ON is a normal mode for selector,
    • SELECTION_OFF selector is turned off, all events are passed,
    • SELECTION_INV inversed mode for selector - selected events are discarded.
  • threshold_peak (default: 0) – threshold on peak amplitude
  • threshold_total(default: 0) – threshold on total peak intensity (in the matrix around peak)
  • n_peaks_min (default: 1) – minimal number of peaks above all thresholds
  • fname (default: "") – file name prefix; by default the prefix is empty and file is not saved
  • print_bits (default: 0) – filter verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - peaks' info,
    • +8 - event record,
    • +16 - event ID.

See also Example for Module ImgAlgos::ImgPeakFilter.

Module ImgAlgos::SaveImageInFile

...

    • the same as previous, but for each 100's event,
    • +16 - event ID.

Remarks:

  • The default key ("Image2D") stands for the CSPadPixCoords::Image2D<double> image object. Other key names work for the ndarray<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.

Module ImgAlgos::ImgPeakFinder

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

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: "CxiDs1.0:Cspad.0DetInfo()") – source of data,
  • key (default: "Image2D") – key for input image key,eventSave data
  • peaksKey (default: "peaks") – key for output list of peaks
  • threshold_low (default: 010) – event number to save the CSPad image file,saveAll low threshold on pixel amplitude
  • threshold_high (default: false100) – save or not all selected events,
  • fname (default: "cspad_image_ev") – common part of the output file name, event number with extension ".txt" will be added at the end.
  • print_bits(default: 0) – verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - info about saved files.

See also Example for Module ImgAlgos::SaveImageInFile.

Module ImgAlgos::TimeStampFilter

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:

  • high threshold on pixel amplitude
  • sigma (default: 1.5) – width of the Gaussian for smearing; =0-no smearing
  • smear_radius (default: 3) – radius in pixel for smearing - radial size of matrix of weights
  • peak_radius (default: 3) – radius in pixel for peak finding - radial size of the region to search for local maximum
  • xmin (default: 0) – minimal column number
  • xmax (default: 100000) – maximal column number
  • ymin (default: 0) – minimal row number
  • ymax (default: 100000) – maximal row number
  • testEvent (default: 0) – event number to save images and print info for test purpose
  • finderIsOn
  • tsinterval (default: "1970-01-01 00:00:00.000000000 / 2100-01-01 00:00:00.000000000") – time-stamp interval string
  • tstamp_min (default: "1970-01-01 00:00:00.000000000") – minimal time-stamp string
  • tstamp_max (default: "2100-01-01 00:00:00.000000000") – maximal time-stamp string
  • filterIsOn (default: true) – On/Off the filteralgorithm
  • print_bits (default: 0) – filter finder verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - number of peaks in the event ID,
    • +8 - time stamp variables for selected event.

The time-stamp string is accepted in various formats:

  • YYYYMMDD HHMMSS.FFF
  • YYYYMMDDTHHMMSS.F
  • YYYY-MM-DD HH:MM:SS.FFF
    but the date field has to be presented mandatory.
    If the 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.

Module ImgAlgos::EventNumberFilter

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.

Note

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:

    • - per event each peak parameters,
    • +16- info about input image format.

Remarks:

  • This algorithm consumes ~15 ms/event on psana0101 for full Opal1000 (1024x1024) camera image.
  • Smearing algorithm use a "safety margin" which is currently set to 10 pixels (offset from each boarder of the full image size).

See also Example for Module ImgAlgos::ImgPeakFinder.

Module ImgAlgos::ImgPeakFilter

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 data
  • key (default: "peaks") – key for input list of peaks, should be the same as peaksKey in ImgPeakFinder
  • selection_mode (default: "SELECTION_ON") – three possible options:
    • SELECTION_ON is a normal mode for selector,
    • SELECTION_OFF selector is turned off, all events are passed,
    • SELECTION_INV inversed mode for selector - selected events are discarded.
  • threshold_peak (default: 0) – threshold on peak amplitude
  • threshold_total(default: 0) – threshold on total peak intensity (in the matrix around peak)
  • n_peaks_min (default: 1) – minimal number of peaks above all thresholds
  • fname (default: "") – file name prefix; by default the prefix is empty and file is not saved
  • 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:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - summary,
    • +4 - selected event number and ID.

There are two modes of operation of this filter.

...

Code Block

 2,5,11-15,20-25,29,30

...

Code Block

  2  5  11  12  13  14  15  20  21  22  23  24  25  29  30

...

    • - peaks' info,
    • +8 - event record,
    • +16 - event ID.

See also Example for Module ImgAlgos::ImgPeakFilter.

Module ImgAlgos::SaveImageInFile

SaveImageInFile is a psana module class, which works after the CSPadImageProducer or CSPadInterpolImageProducer. It receives the CSPadPixCoords::Image2D<double> or ndarray<double,2> image object from the event. (This image object may be used in further data processing.) For test purpose, the image of particular event, defined by the eventSave parameter in configuration file, is saved in the text file with standard predefined name like cspad_image_ev<number>.txt.

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,
  • fname (default: "cspad_image_ev") – common part of the output file name, event number with extension ".txt" will be added at the end.
  • print_bits(default: 0) – verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - info about saved files.

See also Example for Module ImgAlgos::SaveImageInFile.

Module ImgAlgos::CSPadArrSaveInFile

...

  • source (default: "DetInfo(:Cspad)") – input source of data
  • key (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 images
  • maskfile (default: "cspad-pix-mask.dat") – out file with pixel mask
  • rmin (default: 3) – radial parameter of the area for median algorithm
  • dr (default: 1) – radial band width of the area for median algorithm
  • SoNThr (default: 3) – S/N threshold for each pixel to be considered as noisy
  • frac_noisy_img (default: 0.1) – : fraction of noisy images above which pixel is masked in the maskfileprint_bits
  • maskfile (default: 0) – module verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - empty,
    • +4 - processed statistics,
    • +8 - output in files,
    • +16 - event ID,
    • +32 - event time stamp,
    • +32 - vector of indexes and map of indexes for the median algorithm.

See also Example for Module ImgAlgos::CSPadArrNoise.

Module ImgAlgos::CSPadArrPeakFinder

Wiki Markup
This module extends features of the previous {{ImgAlgos::CSPadArrNoise}} module for the case of peak finding.
It works on CSPad data array (shaped as \[5920=4*8*185\]\[388\]) as follows:

  • in the constructor and beginJob(...) method:
    • enters input parameters,
    • (re)set the initial mask of noisy pixels from file hot_pix_mask_file (if its name is specified in the configuration file),
    • do necessary initialization of work arrays.
  • in the event(...) method:
    • uses the "median algorithm" to evaluate the signal and noise for each pixel,
    • Wiki Markup
      fills \[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.
    • use arrays m_proc_status and m_signal to find peaks:
      • Wiki Markup
        iterate over \[185\]\[388\] 2x1 pixels and find the connected regions (using recursive flood-filling algorithm)
      • create vector of peaks v_peaks of struct Peak, using peak_npix_min, peak_npix_max, and peak_amp_tot_thr parameters,
    • loop over v_peaks, count total amplitude and the number of peaks in the event.
    • decide if the event selected or not based on event_npeak_min, event_amp_tot_thr, and selection_mode parameters.
    • periodically dynamically re-generate the mask, based on 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.
    • save m_signal in file for selected events, depending on out_file_bits parameter.
  • put the vector with peaks v_peaks in the evt with key=key_peaks_out.
  • in the endJob(...) method, depending on bit status in out_file_bits :
    • save current hot-pixel mask in the file hot_pix_mask_out_file
    • save current fraction of events with noisy/signal pixels in the file frac_noisy_evts_file

Module configuration parameters:

  • source (default: "DetInfo(:Cspad)") – input source of data
  • key (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 event
  • hot_pix_mask_inp_file (default: "cspad-pix-mask-in.dat") – in read the pixel mask from file
  • hot_pix_mask_out_file (default: "cspad-pix-mask-out.dat") – out write current pixel mask in the file
  • frac_noisy_evts_file (default: "cspad-pix-frac-out.dat") – out file with per-pixel fraction of noisy images
  • evt_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 algorithm
  • dr (default: 1) – radial band width of the area for median algorithm
  • SoNThr_noise (default: 3) – S/N threshold for each pixel to be considered as noisy
  • SoNThr_signal (default: 5) – S/N threshold for each pixel to be considered as noisy
  • frac_noisy_imgs (default: 0.9) – fraction of noisy images above which pixel will be masked
  • peak_npix_min (default: 4) – minimal number of connected pixels for the good peak
  • peak_npix_max (default: 25) – maximal number of connected pixels for the good peak
  • peak_amp_tot_thr (default: 0.) – threshold on total signal amplitude of the group of connected pixels, if =0:OFF
  • peak_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 selection
  • event_npeak_max (default: 10000) – threshold on maximal number of good peaks for the event selection
  • event_amp_tot_thr(default: 0.) – threshold on total signal amplitude in ADU of all good peaks for the event selection, if =0:OFF
  • nevents_mask_update (default: 0) – number of skipped events before each mask re-evaluation cycle
  • nevents_mask_accum (default: 50) – number of events for the mask re-evaluation
  • selection_mode (default: SELECTION_ON) – selection mode, other allowed values are: SELECTION_OFF, or SELECTION_INV
  • out_file_bits (default: 0) – control on writting of files:
    • =0 - do not write files,
    • +1 - save the hot_pix_mask_out_file file with current mask array in the endJob(...) method.
    • +2 - save the frac_noisy_evts_file file with current fraction of noisy events array in the endJob(...) method.
    • +4 - save the CSPad signal array for selected events in the file with name like <evt_file_out>-<counter>-<run>-<time stamp>.txt.
    • +8 - save the vector of found peaks in file <evt_file_out>-<counter>-<run>-<time-stamp>-peaks.txt.
  • print_bits (default: 0) – module verbosity:
    • =0 - print nothing,
    • +1 - input pars (once in beginJob),
    • +2 - initial and current mask statistics (in constructor and when mask is updated),
    • +4 - event selection parameters (for each event); event no., time-stamp, mode, number of peaks, and amp_tot.
    • +8 - output in files (for selected events),
    • +16 - start/stop to collect data for mask re-evaluation (driven by the mode counters),
    • +32 - event time stamp (for each event),
    • +64 - vector of indexes and map of indexes for the median algorithm (once in beginJob),
    • +128 - peak parameters before selection (for each event),
    • +256 - peak parameters saved in file (for selected events),
    • +512 - selection statistics (N<5: for each event; N<50: for each 10-th; N<500: for each 100-th, then for each 1000-th),
    • +1024 - event time stamp (for selected events),
    • Always print:
      • Summary at the endJob.

See also Example for Module ImgAlgos::CSPadArrPeakFinder.

Module ImgAlgos::CSPadArrPeakAnalysis

This module is intended for analysis of the results obtained in the peak finding algorithm implemented in the ImgAlgos::CSPadArrPeakFinder module.

  1. It gets the vector of peaks defined by the key parameter,
  2. fills ROOT-style histograms and ntuples, and
  3. saves histograms and ntuples in file defined by the fname_root parameter.

Module configuration parameters:

  • "cspad-pix-mask.dat") – out file with pixel mask
  • rmin (default: 3) – radial parameter of the area for median algorithm
  • dr (default: 1) – radial band width of the area for median algorithm
  • SoNThr (default: 3) – S/N threshold for each pixel to be considered as noisy
  • frac_noisy_img (default: 0.1) – fraction of noisy images above which pixel is masked in the maskfile
  • print_bits (default: 0) – module verbosity:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - empty,
    • +4 - processed statistics,
    • +8 - output in files,
    • +16 - event ID,
    • +32 - event time stamp,
    • +32 - vector of indexes and map of indexes for the median algorithm.

See also Example for Module ImgAlgos::CSPadArrNoise.

Module ImgAlgos::CSPadArrPeakFinder

Wiki Markup
This module extends features of the previous {{ImgAlgos::CSPadArrNoise}} module for the case of peak finding.
It works on CSPad data array (shaped as \[5920=4*8*185\]\[388\]) as follows:

  • in the constructor and beginJob(...) method:
    • enters input parameters,
    • (re)set the initial mask of noisy pixels from file hot_pix_mask_file (if its name is specified in the configuration file),
    • do necessary initialization of work arrays.
  • in the event(...) method:
    • uses the "median algorithm" to evaluate the signal and noise for each pixel,
    • Wiki Markup
      fills \[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.
    • use arrays m_proc_status and m_signal to find peaks:
      • Wiki Markup
        iterate over \[185\]\[388\] 2x1 pixels and find the connected regions (using recursive flood-filling algorithm)
      • create vector of peaks v_peaks of struct Peak, using peak_npix_min, peak_npix_max, and peak_amp_tot_thr parameters,
    • loop over v_peaks, count total amplitude and the number of peaks in the event.
    • decide if the event selected or not based on event_npeak_min, event_amp_tot_thr, and selection_mode parameters.
    • periodically dynamically re-generate the mask, based on 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.
    • save m_signal in file for selected events, depending on out_file_bits parameter.
  • put the vector with peaks v_peaks in the evt with key=key_peaks_out.
  • in the endJob(...) method, depending on bit status in out_file_bits :
    • save current hot-pixel mask in the file hot_pix_mask_out_file
    • save current fraction of events with noisy/signal pixels in the file frac_noisy_evts_file

Module configuration parameters:

  • source (default: "DetInfo(:Cspad)") – input source of data
  • key (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 event
  • hot_pix_mask_inp_file (default: "cspad-pix-mask-in.dat") – in read the pixel mask from file
  • hot_pix_mask_out_file (default: "cspad-pix-mask-out.dat") – out write current pixel mask in the file
  • frac_noisy_evts_file (default: "cspad-pix-frac-out.dat") – out file with per-pixel fraction of noisy images
  • evt_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 algorithm
  • dr (default: 1) – radial band width of the area for median algorithm
  • SoNThr_noise (default: 3) – S/N threshold for each pixel to be considered as noisy
  • SoNThr_signal (default: 5) – S/N threshold for each pixel to be considered as noisy
  • frac_noisy_imgs (default: 0.9) – fraction of noisy images above which pixel will be masked
  • peak_npix_min (default: 4) – minimal number of connected pixels for the good peak
  • peak_npix_max (default: 25) – maximal number of connected pixels for the good peak
  • peak_amp_tot_thr (default: 0.) – threshold on total signal amplitude of the group of connected pixels, if =0:OFF
  • peak_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 selection
  • event_npeak_max (default: 10000) – threshold on maximal number of good peaks for the event selection
  • event_amp_tot_thr(default: 0.) – threshold on total signal amplitude in ADU of all good peaks for the event selection, if =0:OFF
  • nevents_mask_update (default: 0) – number of skipped events before each mask re-evaluation cycle
  • nevents_mask_accum (default: 50) – number of events for the mask re-evaluation
  • selection_mode (default: SELECTION_ON) – selection mode, other allowed values are: SELECTION_OFF, or SELECTION_INV
  • out_file_bits (default: 0) – control on writting of files:
    • =0 - do not write files,
    • +1 - save the hot_pix_mask_out_file file with current mask array in the endJob(...) method.
    • +2 - save the frac_noisy_evts_file file with current fraction of noisy events array in the endJob(...) method.
    • +4 - save the CSPad signal array for selected events in the file with name like <evt_file_out>-<counter>-<run>-<time stamp>.txt.
    • +8 - save the vector of found peaks in file <evt_file_out>-<counter>-<run>-<time-stamp>-peaks.txt.
  • source (default: "DetInfo(:Cspad)") – input source of data
  • key (default: "peaks") – key for input data for peaks found in event
  • fname_root (default: "file.root") – name of the output file with root histograms and ntuples
  • print_bits (default: 0) – module verbosity:
    • =0 - print nothing,
    • +1 - input pars (once in beginJobin beginJob),
    • +2 - initial and current mask statistics (in constructor and when mask is updated),
    • +4 - event selection parameters (for each event); event no., time-stamp, mode, number of peaks, and amp_tot.
    • +8 - output in files (for selected events),
    • +2 - summary, number of processed and collected events (in endJob16 - start/stop to collect data for mask re-evaluation (driven by the mode counters),
    • +4 - peak parameters (in 32 - event time stamp (for each event),
    • +8 - event ID (in event).

See also Example for Module ImgAlgos::CSPadArrPeakAnalysis.

Module ImgAlgos::PnccdImageProducer

Functionality:

  • gets the pnccd data from the event, based on specified source and inkey parameters,
  • puts the ndarray<double,2> object with pnccd 1024x1024 image in the event using specified outimgkey parameter.

Module configuration parameters:

    • 64 - vector of indexes and map of indexes for the median algorithm (once in beginJob),
    • +128 - peak parameters before selection (for each event),
    • +256 - peak parameters saved in file (for selected events),
    • +512 - selection statistics (N<5: for each event; N<50: for each 10-th; N<500: for each 100-th, then for each 1000-th),
    • +1024 - event time stamp (for selected events),
    • Always print:
      • Summary at the endJob
  • 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:
    • =0 - print nothing,
    • +1 - input pars,
    • +2 - initial portion of pnccd array,
    • +4 - configuration pars
      • .

See also Example for Module ImgAlgos::PnccdImageProducerCSPadArrPeakFinder.

Module ImgAlgos::

...

CSPadArrPeakAnalysis

This module takes care about any generic camera image.
Functionality:

...

module is intended for analysis of the results obtained in the peak finding algorithm implemented in the ImgAlgos::CSPadArrPeakFinder module.

  1. It gets the vector of peaks defined by the key parameter,
  2. fills ROOT-style histograms and ntuples, and
  3. saves histograms and ntuples in file defined by the fname_root

...

  1. parameter.

Module configuration parameters:

  • source (default: "DetInfo(:Opal1000Cspad)") – input source of data,
  • key_in (default: "peaks") – key for input data ,
  • key_out (default: "pnccdimg") – output key for image saved in event,
  • for peaks found in event
  • fname_root (default: "file.root") – name of the output file with root histograms and ntuplessubtract_offset (default: true) – on/off the amplitude offset using configuration data
  • print_bits (default: 0) – module verbosity:
    • =0 - print nothing,
    • +1 - input pars (once in beginJob),
    • +2 - time stamp for each eventsummary, number of processed and collected events (in endJob),
    • +4 - summary at the endJobpeak parameters (in event),
    • +8 - details about data format conversion and applied offsetevent ID (in event).

See also Example for Module ImgAlgos::PnccdImageProducerCSPadArrPeakAnalysis.