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

Compare with Current View Page History

Version 1 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

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:
 

AvImage

 

LDana In [1]: anaps.AvImage?
Type:        instancemethod
String form: <bound method LittleDataAna_psana.AvImage of <LittleDataAna_psana.LittleDataAna_psana object at 0x7fd37fe03590>>
File:        /reg/d/psdm/xpp/xpptut15/res/littleData/xppmodules/scripts/LittleDataAna_psana.py
Definition:  anaps.AvImage(self, detname='None', numEvts=100, thresADU=0.0, thresRms=0.0,useLdat=False, nSkip=0, minIpm=-1.0, common_mode=True)
Docstring:   <no docstring>

LDana In [2]: anaps.AvImage()
detectors in event: 
cs140_rob
opal_1
Select detector to select ROI of?:
cs140_rob
try get detector info to make average image for:  cs140_rob
try to make psana Detector with:  cs140_rob
requested  100  used  100

LDana In [3]: anaps.plotAvImage()
plot AvImg_cs140_rob using the 5/99.5 percentiles as plot min/max: (1603.9, 1950.21)

 

If you would like to take a quick look at your average image before proceeding, use as seen above:
 
 
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).

Mask

 

LDana 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