Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#!/usr/bin/env python

import sys
import numpy as np
import psana

psana.setConfigFile('psana-xppd7114-r0081-cspad2x2-NDArrDropletFinder.cfg')

dsname = 'exp=xppd7114:run=81'
print """Data source: %s""" % dsname
ds = psana.DataSource(dsname)

evnum_max = 50

#------------------------------

for evnum, evt in enumerate(ds.events()) :
    evtid  = evt.get(psana.EventId)
    if evnum > evnum_max : break

    nda_droplets   = evt.get(psana.ndarray_float32_2, psana.Source('DetInfo(XppGon.0:Cspad2x2.0)'), 'nda_droplets')
    nda_smeared    = evt.get(psana.ndarray_float64_3, psana.Source('DetInfo(XppGon.0:Cspad2x2.0)'), 'nda_sme')
    nda_calibrated = evt.get(psana.ndarray_float64_3, psana.Source('DetInfo(XppGon.0:Cspad2x2.0)'), 'nda_clb')

    print print 50*'=', '\nEvent: %d' % evnum
    if (nda_smeared is not None) : print 'nda_smeared.shape = ', nda_smeared.shape

    if (nda_calibrated is not None) : print 'nda_calibrated.shape = ', nda_calibrated.shape

    if (nda_droplets is not None) :
        print 'nda_droplets.shape  = ', nda_droplets.shape
        for droplet in nda_droplets :
            seg, row, col, amax, atot, npix = droplet
            print '    seg:%2d  row:%3d  col:%3d  amax:%8.1f  atot:%8.1f  npix:%2d' % \
                   (seg, row, col, amax, atot, npix)    

...