You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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=amotut13:run=206')
In [3]: det = Detector('AmoETOF.0:Acqiris.0')
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)
Type:        instancemethod
String form: <bound method WFDetector.waveform of <Detector.WFDetector.WFDetector instance at 0x7f07a5b96b90>>
File:        /reg/g/psdm/sw/releases/ana-0.17.14/arch/x86_64-rhel7-gcc48-opt/python/Detector/WFDetector.py
Definition:  det.waveform(self, evt)
Docstring:
Returns np.array with waveforms
        
In [5]: evt = ds.events().next()    (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.03222656 -0.03027344 -0.01757812 ..., -0.03222656 -0.01757812
  -0.03027344]
 ..., 
 [-0.15673828 -0.14453125 -0.16259766 ..., -0.15673828 -0.14892578
  -0.15478516]]
In [7]: 
 
  • No labels