Versions Compared

Key

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



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. You should start is from a smalldata_tools package directory:
Code Block
./producers/runSmallDataAna -r <#> [-e <expname>]

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.

SDAna In: anaps.AvImage()
This will by default create an average image of 100 events of an area detector. The method will list and prompt for a detector name if more than one was recorded.
The full command with all its options can be looked via using the "?" feature of python:
SDAna In: anaps.AvImage?
 
If you would like to take a quick look at your average image before proceeding, call:
Code Block
SDAna In: anaps.plotAvImage()
 
which will result in a figure like this popping up:
Image Removed

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 - circle/donut shape & polygon

Code Block
languagepy
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-click, R-enter), circle(c), polygon(p), dark(d), noise(n) or edgepixels(e)?:
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]])

Mask - noise/std from dark run

This can also be used to make masks with tighter cuts on e.g. the pedestal value and/or the noise/std from the used dark run:

Code Block
languagepy
SDAna In [2]: anaps.MakeMask()
plot AvImg_median_ePix100_1 using the 5/99.5 percentiles as plot min/max: (-0.0800912, 0.131976)
rectangle(r-click, R-enter), circle(c), polygon(p), dark(d), noise(n) or edgepixels(e)?:
n
/sdf/data/lcls/ds/mfx/mfxl1010021/results/smalldata_tools/smalldata_tools/BaseSmallDataAna_psana.py:975: RuntimeWarning: divide by zero encountered in log
  plt.subplot(gsPed[1]).plot(hstPed[1][:-1],np.log(hstPed[0]),'o')
Enter allowed pedestal range (min max)1.5 7
created a mask.... 0
masked in this step:  488.0
masked up to this step:  488.0
masked tot:  488.0
Add this mask?
y
Done?
y
Invert [y/n]? (n/no inversion: masked pixels will get rejected)?
n
Save to calibdir?
y
save mask in /sdf/data/lcls/ds//mfx/mfxl1010021/calib/Epix100a::CalibV1/MfxEndstation.0:Epix100a.0/pixel_mask/ as 18-end.data