Page History
...
It's important to test whether or not the above steps actually worked. To do this, you can use any code that imports experiment data with psanaUsing examples copied from the Building Blocks section will work. The peak finding algorithm specifically is a good example to use because it calls det.calib() and uses ImgAlgos. Below is the sample code from the Event Iteration page from the Building Blocks section, here. If following the multiple environments steps, make sure to activate the environment with the command source activate examplenv.copied from this example.
Code Block | ||
---|---|---|
| ||
from ImgAlgos.PyAlgos import PyAlgos from psana import * ds = DataSource('exp=xpptut15:run=54:smd') det = Detector('cspad') alg = PyAlgos() alg.set_peak_selection_pars(npix_min=2, npix_max=50, amax_thr=10, atot_thr=20, son_min=5) nevent = 0 hdr = '\nSeg Row Col Npix Amptot' fmt = '%3d %4d %4d %4d %8.1f' for nevent, evt in enumerate(ds.events()): if nevent nevent += 1 if nevent == 3: break print 'Processed', nevent, 'events.' |
If successful, you should see the output:
...
language | text |
---|
>= 2:
break
nda = det.calib(evt)
if nda is None:
continue
peaks = alg.peak_finder_v1(nda, thr_low=5, thr_high=21, radius=5, dr=0.05)
print hdr
for peak in peaks:
seg, row, col, npix, amax, atot = peak[0:6]
print fmt % (seg, row, col, npix, atot) |
The experiment name, run number and detector name should all be replace with whatever is being used. If this can run successfully, then psana conda has been installed completely and correctly
...
.