Page History
...
Code Block |
---|
from psana import *
ds = DataSource('exp=xppdaq12:run=54:smd')
det = Detector('cspad',ds.env())
##-----------------------------
# initialize graphics initialization
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(13,12), dpi=80, facecolor='w', edgecolor='w', frameon=True)
axim = fig.add_axes((0.05, 0.03, 0.87, 0.93))
axcb = fig.add_axes((0.923, 0.03, 0.02, 0.93))
plt.ion() # do not hold control on show() in the event loop
##-----------------------------
for nevent,evt in enumerate(ds.events()):
if nevent>10 : break
# includes pedestal subtraction, common-mode correction
# bad-pixel suppression, and geometry
img = det.image(evt)
##-----------------------------
# graphics
axim.cla() # clear image axes if necessary...
ave, rms = img.mean(), img.std() # evaluate average intensity and rms over image pixels
imsh = axim.imshow(img, interpolation='nearest', aspect='auto', origin='upper',\
vmin=ave-1*rms, vmax=ave+2*rms) # make object which produces image in axes
colb = fig.colorbar(imsh, cax=axcb) # make colorbar object associated with figure
fig.canvas.set_window_title('Event %d' % nevent) # set window title
fig.canvas.draw() # equivalent plt.draw() # redraw canvas
if nevent==0 : plt.show() # show plot
plt.ioff() # hold control on show() at the end
plt.show()
##-----------------------------
|
Overview
Content Tools