This script lives in /sdf/group/lcls/ds/ana/tutorials/psana1_examples/wfDetAccess.py.  Currently there are two types of voltage-versus-time ("waveform") detectors  supported: Acqiris (now "Agilent U1065A") and "Imp" detectors.

from psana import *
ds = DataSource('exp=xpptut15:run=280')
det = Detector('ACQ1')
for nevent,evt in enumerate(ds.events()):
    # waveforms are in Volts, times are in Seconds                             
    waveforms = det.waveform(evt)
    times = det.wftime(evt)
    # this shows there are 4 channels, each with 80000 samples                 
    print(waveforms.shape, times.shape)
    break
import matplotlib.pyplot as plt
plt.plot(times[0],waveforms[0])
plt.show()

NOTE: For Acqiris detectors the user can often find between 0-7 "zeros" at the end of the arrays.  This is because the acqiris will read out 80,000 samples, for example, but the trigger is not necessarily on sample 0: from shot-to-shot it can vary between 0 and 7.

In the above user interface we move the data arrays so the trigger happens on sample 0 (so users can more easily add results from different events, for example). But after we do this, to keep the array sizes constant, we pad the end with zeros. This is not ideal, but it makes the user-interface simpler, which is important for LCLS users.

References

  • No labels