Using the tool "ipython" (included in psana) it is possible to interactively explore the capabilities of the various Detector objects, without reading documentation, using "tab completion" and the "?" operator.  All you need to know is your experiment name, run number, and detector name.  An example of such a session is shown here:

[cpo@psana1602 ~/examplePython]$ ipython
Python 2.7.10 (default, May 27 2015, 10:33:01) 
Type "copyright", "credits" or "license" for more information.
IPython 2.3.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
In [1]: from psana import *
In [2]: ds = DataSource('exp=xpptut15:run=280')
In [3]: det = Detector('ACQ1')
In [4]: det.   (NOTE: user hits <TAB> after typing the "." to get list of available methods)
det.dettype                   det.runnum
det.env                       det.set_calib_imp
det.instrument                det.set_correct_acqiris_time
det.iscpp                     det.set_env
det.ispyt                     det.set_print_bits
det.pbits                     det.set_source
det.print_attributes          det.source
det.print_config              det.waveform
det.pyda                      det.wftime
det.raw                       
In [4]: det.waveform?  (NOTE: "?" operator returns help for specified method, including how to call it) Signature: det.waveform(evt)
Docstring:
Returns np.array with waveforms
        
File:      /sdf/group/lcls/ds/ana/sw/conda1/inst/envs/ana-4.0.59-py3/lib/python3.9/site-packages/Detector/WFDetector.py
Type:      method

In [5]: evt = next(ds.events())    (NOTE: getting an event, since the above "Definition" line requires it)
In [6]: print(det.waveform(evt))     (NOTE: calling the "waveform" method as required by the above "Definition" line)  [[ 0.00258789  0.00087891  0.00258789 ...  0.          0.
   0.        ]
 [-0.00400391 -0.00327148 -0.00302734 ...  0.          0.
   0.        ]
 [-0.00742188 -0.00595703 -0.00107422 ...  0.          0.
   0.        ]
 [-0.0027832  -0.00083008 -0.00302734 ...  0.          0.
   0.        ]]
 In [7]: 
 

References

  • No labels