Page History
This script lives in in /reg/g/psdm/tutorials/examplePythonexamplePython3/areaDetAccess.py and 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.
NOTE: there are many other python methods of the Detector object for Area Detectors (e.g. x,y pixel coordinates, pedestal values, masks). One can see all the methods of a class using ipython tab completion, or looking at more complete documentation here, or or examining examples in /reg/g/psdm/sw/releases/ana-current/Detector/examplesexamples3/ex_all_dets.py.
Code Block |
---|
from psana import * ds = DataSource('exp=xpptut15:run=54:smd') det = Detector('cspad') 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() |
...
Code Block |
---|
(ana-4.0.43) psanagpu101:~$ cat junk.py from psana import * runnum = 610 ds = DataSource('exp=xpptut15:run='+str(runnum)) det = Detector('jungfrau4M') im_x = det.image_xaxis(runnum) im_y = det.image_yaxis(runnum) for evt in ds.events(): img = det.image(evt) break print(f'Image shape:', {img.shape},' X shape:', {im_x.shape},' Y shape:',{im_y.shape}') (ana-4.0.43) psanagpu101:~$ python junk.py ('Image shape:', (2203, 2299), 'X shape:', (2203,), 'Y shape:', (2299,)) (ana-4.0.43) psanagpu101:~$ |
...