Versions Compared

Key

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

Include Page
PageMenuBegin
PageMenuBegin
Table of Contents
Include Page
PageMenuEnd
PageMenuEnd

Quick Example

To run interactive-a psana python script execute the following commands.  This requires the ability to ssh to an LCLS unix account and the ability to open up a graphics window on your computer ("X-windows").  Replace "YOURACCOUNTNAME" in the first line below with your unix account name

...

This document offers a brief overview of a high-level interface to the psana analysis framework for user applications scripts written in the Python programming language. The interface is informally known as "interactive psana*. The tool's use is not solely limited to the interactive analysis scenarios. It also allows its users to benefit from a rich set of services of the core framework while retaining a full control over an iteration in data sets (runs, files, etc.). This combination makes it possible for the interactive exploration and (if needed) visualization of the experimental data. Note that by the later latter we always mean data files in the XTC or HDF5 formats produced at by the LCLS DAQ or Data Management system. We also suggest visiting the psana - Interactive API which is found in the end of the document.

...

The rest of the document will map that "philosophy" into practical steps which would need to be taken along that path. We will also cover the basic principles of the psana API as well as their behavioral aspects. Please, keep Keep in mind that the implementation of the interactive the psana python scripts is based on its core psana. Hence there are many commonalities which are shared by these tools, including:

...

The later command should be done just once per session. It will initialize all relevant environment variables, including PATH, LD_LIBRARY_PATH, PYTHONPATH and some others. This will also give you an access to an appropriate version of the Python interpreter and the corresponding Python modules. We recommend using ipython. The following example illustrates how to launch the interpreter and test if the interactive psana the psana python module is available in the session environment. When everything is set up correctly one should see:

...

  • the LCLS DAQ system
  • external psana modules (for example the calibrations or frame reconstruction modules)
  • the psana framework itself (such as the event identifier)
  • the user's code of the interactive psana psana python script (the code can use the event's put() method to extend the event before passing it to another algorithm in the workflow/processing pipeline within the same Python application)

...

  • the DAQ system may produce more than one object for a particular detector, each of which would needed to be unambiguously identified in the event container
  • the external psana modules or the interactive Python code the Python script may add more versions for the same detector object as a result of data processing (calibration, etc.)

...

The previous examples have already demonstrated the very basic technique for finding all events in a data set. The interactive The psana python script has actually more elaborate ways of browsing through the data:

...

One of the features (benefits) of the interactive the psana python script is that it allows one to reuse algorithms which are written as modules for the batch psana. The concept of the modules is explained in details in the Psana User Manual. Here is a simplified architecture of the framework and a data flow between its various components. The first diagram shows using interctive psana python script w/o any external modules, and the second one - with 3 sample modules doing some additional data transformation/processing on the events:

From a prospective of the interactive of psana python script users, each event read from an input data set will have to go first through a chain of modules before finally getting to the user's script. The events may be modified/extended by the modules as they'll be going along this path. This mechanism is opening a number of interesting possibilities:

...

All of this together with a flexibility of the top-level (interactive) Python level Python scripts allows to build rather powerful data processing/analysis workflows (pipelines, etc.).

...

Also note that the core psana also allows an optional data set specification to be placed into the configuration files. This specification will be ignored by the interactive the psana python script where the data set is required to be explicitly passed into function DataSource() as a positional parameter. Please, read the Psana User Manual for further instructions on how to write the configuration files.

...

Unlike its batch version, the interactive the psana python script allows multiple events to be present at a time within the process memory. Consider the following extreme scenario:

...

  • Let's suppose we have an external module written in C++ for the core psana framework.
  • That module would process a waveform extracted from an Acqiris detector and translate it into some custom C++ histogram object. This object is put into the event using the previously explained get() method.
  • Then in the same configuration of the user processing workflow there is another module written in C++ which would consume that histogram and use it on its stage of he even processing. That second module would use event's get() method to fetch the histogram.
  • Now, another user, after learning about this "such easy to use* interactive psana python script wants to benefit from what's been done by the first user and fetch the histogram object from the event using the get() method into their Python code. And that's where ("Oops!*) the problem shows itself up.

...