Page History
...
A simple matplotlib script can be seen in this example. A corresponding version in psmon (which allows much more "interaction" with the plot) is here:
Code Block |
---|
more psmonLocal.py from psana import * ds = DataSource('exp=xpptut15:run=54:smd') det = Detector('cspad',ds.env()) for nevent,evt in enumerate(ds.events()): #img 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)= det.image(evt) break from psmon.plots import Image from psmon import publish # to display the plot from within this script publish.local = True plotimg = Image(0,"CsPad",img) publish.send('IMAGE',plotimg) |
psmon is also able to send plots over the network, which is useful for real-time monitoring. To do this, do not set publish.local=True:
Code Block |
---|
from psana import * from psmon.plots import Image from psmon import publish ds = DataSource('exp=xpptut15:run=54:smd') det = Detector('cspad',ds.env()) for nevent,evt in enumerate(ds.events()): img = det.image(evt) break from psmon.plots import Image from psmon import publish publish.local = True plotimg = Image(0,"CsPad",img) publish.send('imageIMAGE',plotimg) raw_input('Hit <CR> for next event') if nevent>=2: break |
This plot can then be viewed (by multiple people, if desired) using:
...
Code Block |
---|
psplot IMAGE (on the "local" machine)
psplot -s <hostname> (on a "remote" machine, where <hostname> is the name of the host where the above script is running) |
Overview
Content Tools