Versions Compared

Key

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

...

allow to plot the CSPAD 2-d array as image and spectrum, move graphical windows to specified position and show all graphics.

Get

...

CSPAD pixel coordinate arrays

Here we reproduce the test method
example_of_image_built_from_pix_coordinate_array_shaped_as_data()
from the module Examples.py.
This example shows how to get the CSPAD pixel coordinate arrays. In addition, it uses the getTestImageShapedAsData(ds1ev) (slow) method to produce image from the pixel coordinate arrays and data and plots this image.

Code Block
import sys

import CalibPars          as calp
import CalibParsEvaluated as cpe

import GlobalGraphics     as gg # For test purpose in main only
import HDF5Methods        as hm # For test purpose in main only
#----------------------------------------------
def example_of_image_built_from_pix_coordinate_array_shaped_as_data() :
    """Some CSPAD segments may be missing in the dataset
    """   
    fname, runnum = '/reg/d/psdm/CXI/cxi80410/hdf5/cxi80410-r0628.h5',  628
    dsname        = '/Configure:0000/Run:0000/CalibCycle:0000/CsPad::ElementV2/CxiDs1.0:Cspad.0/data'
    path_calib    = '/reg/d/psdm/CXI/cxi80410/calib/CsPad::CalibV1/CxiDs1.0:Cspad.0'
    Range         = (1000,3500)
 
    calp.calibpars.setCalibParsForPath (run=runnum, path=path_calib)
    #cpe.cpeval.printCalibParsEvaluated('center_global')
    cpe.cpeval.evaluateCSPadPixCoordinatesShapedAsData(fname,dsname,rotation=0)
    # At this point pixel coordinates are available and can be extracted:
    xpix, ypix = cpe.cpeval.getCSPadPixCoordinatesShapedAsData_pix()
    print 'xpix =\n', xpix

    # Test image from pixel coordinate and data arrays can be produced and plotted:
    ds1ev = hm.getOneCSPadEventForTest( fname, dsname, event=0 ) # returns array with shape=(29, 185, 388)
    arr = cpe.cpeval.getTestImageShapedAsData(ds1ev)
    gg.plotImage(arr,range=Range,figsize=(11.6,10))
    gg.move(200,100)
    gg.show()
#----------------------------------------------
if __name__ == "__main__" :
    example_of_image_built_from_pix_coordinate_array_shaped_as_data()
    sys.exit ( 'End of test.' )

...