Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Introduction

...

In this note we describe the PyCSPadImage python-package which is intended to convert the CSPad raw data from HDF5 file to the geometry-corrected 2-D image array. This package can be used in a stand-alone python code.

Note

Please note, that LCLS main-stream data analysis framework is based on C++ package Psana. To work with CSPad images Psana has several modules which are collected in the CSPadPixCoords package. Two of these modules, CSPadImageProducer and CSPadInterpolImageProducer, are intended to produce the 2-D array with CSPad image from raw data (currently XTC, but HDF5 will be available soon). Precise CSPad geometry is accounted in Psana using the calibration parameters supplied by the PSCalib package.

In this note we describe the PyCSPadImage package which converts the raw data in geometry-corrected 2-D array with CSPad image for HDF5 data in python.

PyCSPadImage package

Package PyCSPadImage

Content

The python-based PyCSPadImage package consists of Consists of python modules (in alphabetic order):

  • CSPadConfigPars.py - provides access to the CSPad configuration parameters
  • CSPadImageProducer.py - receives raw CSPad data 3-D (32, 185, 388) array, uses calibration parameters, produces the 2-D image array
  • CalibPars.py - provides access to the CSPad calibration parameters
  • CalibParsDefault.py - defines the default CSPad calibration parameters
  • Examples.py - contains examples of how to get the CSPad 2-D image array with corrected geometry
  • GlobalGraphics.py - a set of useful methods for interactive graphic
  • GlobalMethods.py - a set of misceleneous miscellaneous global modules
  • HDF5Methods.py - a set of methods to work with HDF5 files

Functionality

The PyCSPadImage package is intended to convert the CSPad raw data from HDF5 file to the geometry-corrected 2-D image array. Methods of this package provide basic functionality as follows.

  • Raw data 3-D (32, 185, 388) array can be be obtained from HDF5 file by its record name using methods from the module HDF5Methods.py. The CSPad dynamic configuration parameters are also uploaded using methods from the class CSPadConfigPars.
  • Access to the CSPad geometry calibration parameters are provided by the methods of the classes CalibParsDefault and CalibPars. It is assumed that the geometry calibration files, are available (see CSPad alignment) and located in the user-specified directory.
  • Methods of the class CSPadImageProducer allows to get the geometry-corrected CSPad image or its part for specified 2x1 or quad.

How to get this package

Below we assume that all standard environment variable settings are done (oservice otherwise see Analysis Workbook. Account Setup). In order to copy the PyCSPadImage package from SVN repository and run a simple test one has to use commands:

Code Block
 
loginlog in to psanaXXXXpsana<XXXX>
kinit
cd <your-favorite-directory>

newrel ana-current <your-release-directory-name>
cd <your-release-directory-name>
sit_setup
addpkg PyCSPadImage HEAD

cd PyCSPadImage/src/          <==== All source-code files are located here
python Examples.py

...

Module Examples.py demonstrates of how to use the PyCSPadImage package. The essential part of the example can be presented as:

...

Note
  • Currently, the calibration parameters are defined through the "singleton" object calp.calibpars.
    If more than one CSPad is going to be used simultaneously, then different sets of calibration parameters
    need to be loaded and the calp.calibpars needs to be de-referenced whenever it is necessary.
  • Run number needs to be specified if there are more than one calibration file available for different run ranges.

...

Code Block
 
    gg.plotImage(arr,range=(0,2000),figsize=(11.6,10))
    gg.plotSpectrum(arr,range=(0,2000))
    gg.show()

References