The following example code uses the V1 peak finder which can be found here to obtain an array of peaks.
from ImgAlgos.PyAlgos import PyAlgos from psana import * ds = DataSource('exp=xcs06016:run=37:smd') det = Detector('epix_2') alg = PyAlgos() alg.set_peak_selection_pars(npix_min=1, npix_max=4, amax_thr=0, atot_thr=35, son_min=0) centroids = [] for nevent, evt in enumerate(ds.events()): if nevent == 25: break nda = det.calib(evt) peaks = alg.peak_finder_v1(nda, thr_low=10, thr_high=30, radius=1, dr=0) for p in peaks: centroids.append([p[6], p[7]]) print '%d total peaks.' % len(centroids) centroids = np.array(centroids) calib = CentroidSmootherCalib() calib.add(centroids) calib.save(ds, det, 0) cs = CentroidSmoother(ds, det, evt.run())
Overview
Content Tools