You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Use of SmallDataAna_psana

For the use of the interactive features of SmallDataAna_psana, we recommend to start it in an ipython session as interactive grabbing of user input is currently not implemented via the notebook.

Creating an average image

 

In order to decide on the proper ROI, fit a team center or make a mask, the first step is always to create an image that you would like to use as base. This is achieved using the following function in the python terminal opened from:

/reg/d/psdm/<hutch>/<expname>/results/smalldata_tools via:

./examples/runSmallDataAna -r <run#>

SDAna In: anaps.AvImage()
This will by default create an average image of 100 events of an area detector. 
The full command with all its options and a examples is here:
 
If you would like to take a quick look at your average image before proceeding, call:
SDAna In: anaps.plotAvImage()
 
which will result in a figure like this popping up:

Creating mask file

SDAna In: anaps.MakeMask()

This will by draw the image and let you define a mask using rectangles, circles and polygons defined by mouse clicks. You can add several of these shapes. This mask can be saved locally or in the calib directory where it will be available for the littleData creation. Masks are e.g. used for the azimuthal integration. A session where a mask consisting of the inner circle and a polygon was developed is shown below. For each part of the mask, you can either use a circle, rectangle or polygon. The mask will then be shown to you. Once you have defined all the sub-masks, the total mask is calculated and applied to the image. If so desired, the mask can then be stored either locally or in the calibdirectory (where the littleData creating will pick it up automatically).

Other options are masking a number of edge-pixels (sometimes more than a single row of pixels should be masked). You can also mask pixels based on the calibration status (either the pedestal or the noise value).


Mask

SDana In [3]: anaps.MakeMask()
(32, 185, 388)
plot AvImg_cspad using the 5/99.5 percentiles as plot min/max: (0.199616, 263.383)
rectangle(r), circle(c) or polygon(p)?:
c
Select center by mouse?
y
/reg/g/psdm/sw/releases/ana-0.17.30/arch/x86_64-rhel7-gcc48-opt/python/matplotlib/backend_bases.py:2399: MatplotlibDeprecationWarning: Using default event loop until function specific to this GUI is implemented
  warnings.warn(str, mplDeprecation)
center:  98067.8500159   87780.7509265
Select outer radius by mouse?
y
Select inner radius by mouse?
n
radii:  6044.641774   0
mask from circle (shape): (32, 185, 388)
Done?
n
created a mask....
masked now:  9506.0
masked tot:  9506.0
rectangle(r), circle(c) or polygon(p)?:
p
Number of Points (-1 until right click)?
5
[[  81561.33638984   90357.32502125]
 [  75822.06188735   95379.19021093]
 [  80126.51776422  101477.16936983]
 [  86941.90623593  100401.05540061]
 [  86583.20157952   92509.55295969]]
mask from polygon (shape): (32, 185, 388)
not implemented yet....
Done?
y
created a mask....
masked now:  5649.0
masked tot:  15155.0
Save to calibdir?
n
Save to local?
y
Invert?
n
LDana Out[3]: 
array([[1, 1, 1, ..., 1, 1, 1],
       [1, 1, 1, ..., 1, 1, 1],
       [1, 1, 1, ..., 1, 1, 1],
       ..., 
       [1, 1, 1, ..., 1, 1, 1],
       [1, 1, 1, ..., 1, 1, 1],
       [1, 1, 1, ..., 1, 1, 1]])
Two submasks being created
masked image
  • No labels