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

Compare with Current View Page History

« Previous Version 2 Next »

This script lives in /reg/g/psdm/tutorials/examplePython/cfd.py and demonstrates how to run a constant-fraction-discriminator algorithm on a waveform (similar to a peak-finder for area-detectors).

from psana import *
from pypsalg import find_edges
ds = DataSource('exp=amotut13:run=206')
det = Detector('DetInfo(AmoETOF.0:Acqiris.0)',ds.env())
import matplotlib.pyplot as plt
for nevent,evt in enumerate(ds.events()):
    waveforms,times = det.raw(evt)
    # find edges for channel 0                                                  
    # parameters: baseline, threshold, fraction, deadtime, leading_edges        
    edges = find_edges(waveforms[0],0.0,-0.05,1.0,5.0,True)
    # pairs of (amplitude,sampleNumber)                                         
    print edges
    break
  • No labels