Versions Compared

Key

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

...

  • This isn't an explanation how to do the data analysis. Note that our goal is to explain basic techniques for getting to your data, not for using it!
  • This is not a Users or Reference Guide for the interactive framework

...

The pyana users, attention!

As it's been announced earlier, the pyana framework will be phased out at some point. There is a variety of reason why:

...

Code Block
psana
[error:2013-06-06 20:54:44.131:PSAnaApp.cpp:218] no analysis modules specified

3 Basic examples

This section presents a few simple scripts which have been developed to underline the main ideas behind the framework's API. The code of the examples along with a simple HOWTO file can be found at:

Code Block

/reg/g/psdm/tutorials/common/data_access_methods/

Printing identifiers of all events if a run

Try this:

Code Block

./print_event_id.py

Then look at the code. It will do three things:

  • import the psana module:
    Code Block
    
    import psana
    
  • open the data set. Note the syntax for the data set specification string:
    Code Block
    
    dsname = "exp=sxrtut13:run=366"
    ds = psana.DataSet(dsname)
    
  • note that by default the framework will look for XTC files at the standard location where all experimental data are supposed to be. If you want to play with HDF (in case if there are HDF5* version of the run) you may slightly change that string by appending h5 in the end:
    Code Block
    
    dsname = "exp=sxrtut13:run=366:h5"
    
  • the next thing which this code will do will be to iterate over all events. At each step you will get a reference to an event object evt and it will extract and print an identifier of the event:
    Code Block
    
    for i, evt in enumerate(ds.events()):
        evtnum = i + 1
        id = evt.get(psana.EventId)
        print "%6d:" % evtnum, id
    

In the end you're supposed to see something like this:

Code Block

./print_event_id.py
     1: XtcEventId(run=366, time=2013-04-21 04:37:39.343773772-07, fiducials=38877, ticks=329342, vector=19553)
     2: XtcEventId(run=366, time=2013-04-21 04:37:39.360457259-07, fiducials=38883, ticks=331442, vector=19554)
     3: XtcEventId(run=366, time=2013-04-21 04:37:39.377123777-07, fiducials=38889, ticks=330560, vector=19555)
     4: XtcEventId(run=366, time=2013-04-21 04:37:39.393797466-07, fiducials=38895, ticks=329762, vector=19556)
     5: XtcEventId(run=366, time=2013-04-21 04:37:39.410477971-07, fiducials=38901, ticks=331204, vector=19557)
     6: XtcEventId(run=366, time=2013-04-21 04:37:39.427145705-07, fiducials=38907, ticks=331036, vector=19558)
     7: XtcEventId(run=366, time=2013-04-21 04:37:39.443816588-07, fiducials=38913, ticks=329370, vector=19559)
     8: XtcEventId(run=366, time=2013-04-21 04:37:39.460499778-07, fiducials=38919, ticks=331414, vector=19560)
     9: XtcEventId(run=366, time=2013-04-21 04:37:39.477167658-07, fiducials=38925, ticks=330616, vector=19561)
    10: XtcEventId(run=366, time=2013-04-21 04:37:39.493840079-07, fiducials=38931, ticks=329720, vector=19562)
    ...

4. Instrument-specific examples

5 Doing something more complex