Page History
...
Module ImgAlgos::CSPadArrPeakFinder
Wiki Markup |
---|
In this moduleModule {{ImgAlgos::CSPadArrPeakFinder}} is a psana-based implementation of the "median algorithm" is implemented 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|PCDS: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. |
...
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:- =0 - save nothing,
- +1 - save the
hot_pix_mask_out_file
file with current mask array in theendJob(...)
method. - +2 - save the
frac_noisy_evts_file
file with current fraction of noisy events array in theendJob(...)
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 - summary at the
endJob
, - +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),
- +2048 - peak finding from connected pixels; this is printed for connected region of signal pixels if
npix > peaknpix>peak_npix_min-2
(otherwise too much junk output).
- =0 - summary at the
...
Overview
Content Tools