Page History
...
XTCAV is a detector that is used to determine the laser-power vs. time of each LCLS shot. Alvaro Sanchez-Gonzalez has written psana-python code to do the rather complex analysis of images from the XTCAV camera to determine these quantities. Some detailed documentation from Tim Maxwell on this device is Here.
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. They analyze a minimal number of events to make them run fairly quickly.
Analysis Setup
Two things must be done before XTCAV analysis will function: a "dark run" must be analyzed to get the pedestal values for cameras, and a "no lasing" run must be analyzed to generate sets of "no lasing" images (the latter is quite a complex process). An example of a dark-run analysis is in /reg/g/psdm/tutorials/examplePython/xtcav/xtcavDark.py:
Code Block | ||
---|---|---|
| ||
#!/usr/bin/env python # these two lines for example purposes only, to allow user to write # calibration information to local directory called "calib". # should be deleted for real analysis. import psana psana.setOption('psana.calib-dir','calib') from xtcav.GenerateDarkBackground import * GDB=GenerateDarkBackground(); GDB.experiment='amoc8114xpptut15' GDB.runs='85102' GDB.maxshots=100010 GDB.SetValidityRange(85101,109125) # delete second run number argument to have the validity range be open-ended ("end") GDB.Generate(); |
An example of a non-lasing run is in /reg/g/psdm/tutorials/examplePython/xtcav/xtcavLasingOff.py:
Code Block | ||
---|---|---|
| ||
#!/usr/bin/env python # these two lines for example purposes only, to allow user to write # calibration information to local directory called "calib". # should be deleted for real analysis. import psana psana.setOption('psana.calib-dir','calib') from xtcav.GenerateLasingOffReference import * GLOC=GenerateLasingOffReference(); GLOC.experiment='amoc8114xpptut15' GLOC.runs='86101' GLOC.maxshots=14012 GLOC.nb=12 GLOC.islandsplitmethod = 'scipyLabel' # see confluence documentation below for how to set this parameter GLOC.groupsize=5 # see confluence documentation below for how to set this parameter GLOC.SetValidityRange(86101,91125) # delete second run number argument to have the validity range be open-ended ("end") GLOC.Generate(); |
This script can be quite slow. It can be easily run in parallel by submitting a parallel MPI job to the batch system as described here, however you should change the above script to increase the "maxshots" parameter (so that each core has at least 1 shot to process).
Once the dark/lasing-off analysis Once the above has been completed, the user can analyze the lasing-on events using the script below.
Example Analysis Script
This script assumes that dark/lasing-off data has been analyzed (see above) and can be found in /reg/g/psdm/tutorials/examplePython/xtcav/xtcavLasingOn.py:
Code Block | ||
---|---|---|
| ||
import psana # this line is for example purposes only, to allow user to read # calibration information from local directory called "calib". # should be deleted for real analysis. psana.setOptions({'psana.calib-dir':'calib', 'psana.allow-corrupt-epics':True}) from xtcav.ShotToShotCharacterization import * experiment='amoc8114xpptut15' #Experiment label runs='87124' #Runs #Loading the dataset from the "dark" run, this way of working should be compatible with both xtc and hdf5 filesf iles dataSource=psana.DataSource("exp=%s:run=%s:idx" % (experiment,runs)) #XTCAV Retrieval (setting the data source is useful to get information such as experiment name) XTCAVRetrieval=ShotToShotCharacterization(); XTCAVRetrieval.SetEnv(dataSource.env()) for r,run in enumerate(dataSource.runs()): times = run.times() for t in times: evt = run.event(t) if not XTCAVRetrieval.SetCurrentEvent(evt): continue time,power,ok=XTCAVRetrieval.XRayPower() agreement,ok=XTCAVRetrieval.ReconstructionAgreement() |
This script runs on one core, but it can be MPI-parallelized in the standard psana-python manner described here.
How Often to Take a Lasing Off Run
...