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

Compare with Current View Page History

« Previous Version 18 Next »

This script lives in /reg/g/psdm/tutorials/examplePython/areaDetAccess.py and demonstrates how to access calibrated "unassembled data" (3D array, no geometry applied) and "assembled images" (2D array, geometry applied).  Assembled/unassembled are only different for multi-panel detectors.  For monolithic 2D area detectors they are the same.

from psana import *
ds = DataSource('exp=xpptut15:run=54:smd')
det = Detector('cspad',ds.env())
for nevent,evt in enumerate(ds.events()):
    # includes pedestal subtraction, common-mode correction, bad-pixel
    # suppresion, and returns an "unassembled" 3D array of cspad panels
    calib_array = det.calib(evt)
    # this is the same as the above, but also uses geometry to
    # create an "assembled" 2D image (including "fake pixels" in gaps)
    img = det.image(evt)
    break
import matplotlib.pyplot as plt
plt.imshow(img,vmin=-2,vmax=2)
plt.show()

One can see all the methods of a class using ipython tab completion, or a full list of all methods of the "Detector" object can be found here:

/reg/g/psdm/sw/releases/ana-current/Detector/examples/ex_all_dets.py

You can find a version with more advanced graphics here.

The Detector interface can be used to access several types of detectors.  More documentation on specific detector types can be found here:

 

  • No labels