Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

These scripts use some XTCAV data that was made public so they should be runnable by all users. The scripts can be found in /reg/g/psdm/tutorials/examplePython/xtcav/ *** in the files xtcavDark.py, xtcavLasingOff.py, xtcavLasingOn.py.

...

This script assumes that dark/lasing-off data has been analyzed (see above).   Unlike the previous two scripts it reads dark/lasing-off constants from the official calibration-directory.  This script can be found in /reg/g/psdm/tutorials/examplePython/xtcav/xtcavLasingOn.py:  

Code Block
languagepython
from psana import *
import matplotlib.pyplot as plt
from xtcav.LasingOnCharacterization import *
experiment = 'xpptut15'
run = '302'
mode = 'smd'
ds = psana.DataSource("exp=%s:run=%s:%s" % (experiment, run, mode))
ngood = 0
XTCAVRetrieval=LasingOnCharacterization() 
for evt in ds.events():
    if not XTCAVRetrieval.processEvent(evt):
        continue # continue to next image if analysis fails for some reason
    # time and power are lists, with each entry corresponding to
    # a bunch number.  The number of bunches is set by the GLOC.nb
    # parameter in the lasing-off analysis.  In general, one should
    # also cut on the "agreement" value, which measures the agreement
    # between the first and second moment analysis (larger is better).
    time, power = XTCAVRetrieval.xRayPower(method='RMS')  
    agreement = XTCAVRetrieval.reconstructionAgreement()
    ngood += 1
    print 'Agreement: %g%% ' % (agreement*100)
    plt.plot(time[0],power[0])
    plt.xlabel('Time (fs)')
    plt.ylabel('Lasing Power (GW)')
    plt.title('Agreement %4.2f'%agreement)
    plt.show()
    if ngood > 1: 
        break

...