Versions Compared

Key

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

Content

Table of Contents

Example for module NDArrDropletFinder

See description of the module in Module ImgAlgos::NDArrDropletFinder

...

which defines parameters of a few modules with functionality as follows.

Script functionality

  • CSPadPixCoords.CSPad2x2NDArrProducer - get raw data for XppGon.0:Cspad2x2.0 and put them in the event store as ndarray with key nda_raw
  • ImgAlgos.NDArrCalib - get ndarray with key nda_raw, applies a bunch of intensity corrections, and saves in the event store the ndarray with key nda_clb:as_data
  • CSPadPixCoords.CSPad2x2NDArrReshape - re-shuffle cspad2x2 pixels shaped as data [185,388,2] to "natural" ndarray format [2,185,388]
  • ImgAlgos.NDArrDropletFinder - gets calibrated and shaped as two 2-d segments ndarray  nda_clb, applies smearing (if sigma>0), find droplets (wide peaks), and saves them in the event store and in the file (if fname_prefix is not empty).

Remarks about parameters

  • For each new set of smearing parameters (if applied, sigma>0) the droplet-finder parameters need to be re-tuned.
  • Number of windows per sensor is unlimited but the should not overlap each other in order to get rid of duplication of found peaks in the overlapping regions. 
  • Parameter low_value = −0.1 is set for demonstration purpose - in order to distinguish on plot sensors' pixels from image bins.
  • Parameter fname_prefix = test is set in demonstration purpose in order to save image and peak data files for browser

Running script with psana

This file can be executed by the command

...

Fig.1: Image of cspad2x2, containing two 2x1 segments. Droplet-finder is applied to the calibrated and smeared data in three windows.

Format of the ndarray of droplets

Content of the record for each droplet is defined by the structure of six components

...

Code Block
0         127       137       5.01175   60.1614   20      
0         129       166       4.55816   52.7998   20      
0         155       131       4.09197   48.5101   20      
1         105       17        3.65102   17.5217   6       
1         145       49        3.87695   30.5501   15      
1         116       249       3.07719   20.5181   11      
1         139       325       3.60641   60.2324   27    
...

Access droplet data in python

Example of the python script psana-xppd7114-r0081-cspad2x2-NDArrDropletFinder.py:

...

In order to eliminate too excessive printout from psana modules, set parameters print_bits = 0 or 1 in the configuration file.

Examples for exp=cxif5315:run=165

Example 1

Shows how to get ndarray with CSPAD  data in psana, calibrate it, find peaks (droplets) in imaging data and plot them offline.

...

Code Block
ImgAlgos/data/PlotNDArrayAndPeaks.py -g /reg/d/psdm/CXI/cxif5315/calib/CsPad::CalibV1/CxiDs2.0:Cspad.0/geometry/1-end.data -i test-cxif5315-r0165-e000001-raw.txt

Example 2

Shows how to get ndarray with CSPAD  data in psana, calibrate it, prepare and apply mask, find peaks (droplets) in imaging data and plot them offline.

...

This viewer shows images like:

 

Example 3

Example 3 has the same functionality as Example 2. Also this example shows how to

...

  • which does all work and plots images with peaks like - background is not subtracted, or - background is subtracted

 

 

Get latest version

Release ana-current (ana-0.13.18 or later) has the latest version of all necessary packages.

...

Note

Packages PSCalib and CSPadPixCoords need to be added because they have been modified on the top of ana-0.13.13 release. They need to be compiled together due to dependency between packages.

 

References

...