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

Compare with Current View Page History

« Previous Version 4 Next »

Summing Over Scan Steps With An Integrating Detector

In this case the images being summed are uint16, so the sums overflow, but the idea is correct.

from psana import DataSource
import os
os.environ['PS_SMD_N_EVENTS'] = '50' # Number of integrating detector events
os.environ['PS_SRV_NODES']='1'

ds = DataSource(exp='rixx1003721', run=161, intg_det='epixhr')
smd = ds.smalldata(filename='phil.h5')
myrun = next(ds.runs())
epix = myrun.Detector('epixhr')
nevt=0
step_sums = {}
for nstep,step in enumerate(myrun.steps()):
    localsum = None
    for nevt,evt in enumerate(step.events()):
        if localsum is None:
            localsum = epix.raw.raw(evt)
        else:
            localsum += epix.raw.raw(evt)
    step_sums[str(nstep)] = smd.sum(localsum)
if smd.summary:
    smd.save_summary(step_sums)
smd.done()
  • No labels