Versions Compared

Key

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

Content

Table of Contents

Quick Start

These commands setup the psana environment, get the code, analyze 5 events with 2 separate hit finders in the equator/arc regions, display the found hits, and save the resulting hit information to a "small-data" text file (similar to cheetah): 

...

This same script can also read cheetah-produced text files, and only analyze specific events

Data

Calibration files

Use my local calibration store

...

Difference of average dark images between runs 147-198 is small, 0.3 ADU, difference rms=0.6 ADU, this proves that CxiDs2.0:Cspad.0 is stable during 50 runs.

 

Image array averaging

Image array averaging is useful procedure for many purpose;

...

Geometry alignment

In accordance with CSPAD Alignment, use geometry file:

...

and similar for water background from run 162: 

ROI Masks

Using image array in cspad-ndarr-max-cxif5315-r0169.dat and geometry file geo-cxif5315-r0169-swap-tuned.data, one can generate masks using the Mask Editor embedded in Calibration Manager.

...

Peak finder

Who is doing what

Peak finding algorithm is based on psana module ImgAlgos::NDArrDropletFinder with preceded CSPAD ndarray producer CSPadPixCoords::CSPadNDArrProducer and its calibration ImgAlgos::NDArrCalib. Detector geometry information is provided by the module ImgAlgos::PixCoordsProducer. Configuration file  psana-cxif5315-r0169-cspad-ds2-NDArrDropletFinder.cfg (download)  defines parameters for these modules. Two instances of modules are used in order to process two region of interests for Arc and Equator.

For each event psana modules are executed first and save the list of found peaks in the event store. Then, python script psana-cxif5315-r0169-cspad-ds2-NDArrDropletFinder.py (download) works with lists of peaks, performs additional selection, plots image with peaks, and saves selected peaks in the file.

Latest version of packages

On 2015-04-16:

Release ana-0.14.2 is up to date.

...

Code Block
sit_setup ana-0.14.2

 

 

External files

In order to run examples create directory with some arbitrary name my_analysis and work directory in it:

...

In the local or standard calib/ directory the files for calibration should be available for geometry, pedestals, pixel_status, common_mode etc., whatever is going to be used in the modules.

How to run

Use command:

Code Block
python psana-cxif5315-r0169-cspad-ds2-NDArrDropletFinder.py

Example: get table of peaks for different regions

Image with peaks for separate and both regions can be plotted:

...

The 1st line in this file is a (commented) header with colon-titles.

Remarks

  • Peak finder parameters - all parameters in the peak finder are set without optimization. They need to be tuned in two places;
    1.  in the configuration file for two modules ImgAlgos.NDArrDropletFinder(:Arc/:Equ), and
    2.  in the python script in calls of peaks_filter(...) method.
  • ROI for peakfinder is defined by combination of two mechanisms;
    1. mask - ndarray with values 1/0. Pixels masked by "0", are ignored.
    2. a set of rectangular windows on sensors, defined by the parameter windows in module ImgAlgos::NDArrDropletFinder.
  • Peak finder parameters need to be optimized!

 

Peaks in Arc region

Selection parameters

Selection of peaks and events is defined in few stages, as listed below.

...

ParameterSel.1 (rpeak5)Sel.2 (rpeak7)Sel.3 (rpeak3)
Process peaks from file
selector in method peakIsSelected()
amax
150150150
atot
2500
2500
2500
npix
204020
rmin
434434434
rmax444444444
phi
<-150 & >150<-150 & >150<-150 & >150

 

Plots for selection parameters

Distribution for selection parameters are shown below. The 1st group of plots is accumulated for all peaks saved in the file with list of peaks:

...

  • Npeaks selected - number of peaks in the event
  • Distance - between two peaks [pixels] in the event which has two selected peaks only
Sel.1 (rpeak=5):

These distributions were obtained for "reasonable-by-eye" selection criteria. Now the question is how optimal the selection parameters are?

 

Sel.2 (rpeak=7):

 

These plots look noisy, because it was allowed to save up to 20 peaks in the event.

Sel.3 (rpeak=3):

Tight parameters in this case reduce a number of signal events in the Distance distribution.

Optimal parameters

  • peak_radius = 3, 5, 7 - or peak region sixe 7x7, 11x11, 15x15, respectively does not show significant influence on figure of merit (FOM) distance distribution. Keep 5 as golden-medium.
  • amax and atot show significant increase in number of peaks for <150 and <2500, respectively. These selection criteria do not decrease a signal peak in FOM. To be safe we may still pre-select peaks  with  amax<100 and atot<2000 and then apply tight selection later.
  • npix -it is safe to require >20 or >30.

  • r - chosen range 434 ≤ r ≤ 444 looks optimal
  • npeaks_max is less than 6 after selection. It looks safe to constrain npeaks_max = 10. Used 20 adds too much noise.

So far original Selection 1 looks optimal.

 

Peaks in Whiskers region

 

Parameters

Set in psana.cfg file peak selection parameters pretty much the same as in Arc region

...

save peaks in file without additional selector.

Events

Event 03: - normal, single hit event

...

Note

In the matrix frame x-axis points down...

 

Distributions for peak parameters without selection

Number of peaks

Peak azimuth angle

Peak radius

Distributions for >1-peak event in each region

Average over peaks azimuth angle

...

Standard deviation of azimuth angle spread

Combined distributions for two regions

Difference between averaged azimuth angles in two regions

Orientation angle

Remarks

  1. Peak radius equal to 3 or 5 pixel with low and high thresholds 10 and 150ADU, respectively, work fine.

  2. More than 90% events have more than 2 peaks in each side of "whiskers" region. Constrains on number of peaks >1 in each region should be used to select good single-hit events.
  3. Constrain on phi_std<0.5 or phi_ptp<1 can be used to select good single-hit events.
  4. Average azimuth angle can be used as a measure of event orientation.

 

Peaks in Equatorial region

Peak-finder parameters

Code Block
[ImgAlgos.NDArrDropletFinder:Equ]
source         = DetInfo(CxiDs2.0:Cspad.0)
key            = nda_clb
key_droplets   = nda_droplets_equ
key_smeared    = nda_sme_equ
threshold_low  = 10
threshold_high = 150
sigma          = 0
smear_radius   = 3
peak_radius    = 3
low_value      = 0.
mask           = work/roi_mask_nda_equ.txt
masked_value   = 0
windows =  0 0 185 0 388 \
           1 0 185 0 388 \ 
           3 0 185 0 388 \ 
           8 0 185 0 388 \
           9 0 185 0 388 \
          11 0 185 0 388 \
          16 0 185 0 388 \
          17 0 185 0 388 \
          19 0 185 0 388 \
          24 0 185 0 388 \
          25 0 185 0 388 \
          27 0 185 0 388
fname_prefix = 
print_bits   = 3

Distribution of parameters after peak-finder

Where additional peak selection parameters in the python script:

Code Block
    if npix>42   : return False
    if r<100     : return False
    if r>460     : return False

 

Combined analysis for Arc and Equ regions

Peak finding in psana

In psana event processing the same peak definition parameters were used for Arc and Equ regions:

...

All peaks found in the event were saved in the peak table file without additional selection.

Peak selection in file processing

Arc region selection

Code Block
    if atot<2500 : return False
    if npix>42   : return False
    if r<434     : return False
    if r>444     : return False
    if phi<150 and phi>-150 : return False

...

- number of peaks in Equ region (constrain on sp.count_equ_pks_sel is not applied).

Scripts for analysis on 2015-05-18

Current version of scripts with comments is collected here. It is assumed that you work on one of psana nodes which has access to data, for example:

...