Page History
...
Code Block |
---|
import psana
from xtcav2.LasingOnCharacterization import LasingOnCharacterization
import matplotlib.pyplot as plt
import sys
ds = psana.DataSource('exp=xppc00120:run='+sys.argv[1]+':smd')
XTCAVRetrieval = LasingOnCharacterization()
print(dir(XTCAVRetrieval))
for evt in ds.events():
XTCAVRetrieval.processEvent(evt)
# method 1: center-of-mass
t, powerCOM = XTCAVRetrieval.xRayPower(method='COM')
if t is None: continue
# method 2: RMS
t, powerRMS = XTCAVRetrieval.xRayPower(method='RMS')
agreement = XTCAVRetrieval.reconstructionAgreement()
plt.title('agreement: %4.2f'%agreement)
plt.xlabel('Time (fs)')
plt.ylabel('Power (GW)')
# a useful named-tuple with details of the shot analysis
#res = XTCAVRetrieval.fullResults()
# [0] index needed for potential multi-bunch analysis
plt.plot(t[0],powerCOM[0,:],label='COM')
plt.plot(t[0],powerRMS[0,:],label='RMS')
plt.legend()
plt.show() |
...
Overview
Content Tools