コード例 #1
0
ファイル: CSPAD2x2Image.py プロジェクト: FilipeMaia/psdmrepo
def get_cspad2x2_non_corrected_image_for_raw_data_array(arr) :
    if arr.shape != (185,388,2) :
        msg = 'Non-expected array shape for cspad2x2: %s' % arr.shape
        print msg
        return None
    
    coord = CSPAD2x2PixCoords()
    iX,iY = coord.get_cspad2x2_pix_coordinate_arrays_shapeed_as_data_pix ()
    
    img2d = gg.getImageFromIndexArrays(iX,iY,arr)
    return img2d
コード例 #2
0
def get_cspad2x2_non_corrected_image_for_raw_data_array(arr):
    if arr.shape != (185, 388, 2):
        msg = 'Non-expected array shape for cspad2x2: %s' % arr.shape
        print msg
        return None

    coord = CSPAD2x2PixCoords()
    iX, iY = coord.get_cspad2x2_pix_coordinate_arrays_shapeed_as_data_pix()

    img2d = gg.getImageFromIndexArrays(iX, iY, arr)
    return img2d
コード例 #3
0
ファイル: CSPAD2x2Examples.py プロジェクト: htlemke/ixppy
def test_CSPAD2x2PixCoords() :
    """Test demonstration of how to work with CSPAD2x2CalibPars and CSPAD2x2PixCoords modules
    """    
    #======= Define input parameters
    Ndet = 5
    run  = 180
    path = '/reg/d/psdm/mec/mec73313/calib/CsPad2x2::CalibV1/MecTargetChamber.0:Cspad2x2.%1d/' % Ndet
    #path = '/reg/neh/home1/dubrovin/LCLS/CSPad2x2Alignment/calib-cspad2x2-0%1d-2013-02-13/' % Ndet
    #fname  = '/reg/d/psdm/mec/mec73313/hdf5/mec73313-r%04d.h5' % run
    fname  = '/reg/neh/home1/dubrovin/LCLS/HDF5Analysis-v01/PyCSPadImage/src/mec73313-r%04d.h5' % run
    dsname = '/Configure:0000/Run:0000/CalibCycle:0000/CsPad2x2::ElementV1/MecTargetChamber.0:Cspad2x2.%1d/data' % Ndet
    list_of_clib_types = ['center', 'tilt', 'pedestals']

    #======= Get calibration object
    calib = calpars.CSPAD2x2CalibPars(path, run, list_of_clib_types)

    #======= Get CSPAD2x2 pixel coordinate arrays, shaped as (2, 185, 388)
    coord = pixcoor.CSPAD2x2PixCoords(calib)
    X,Y = coord.get_cspad2x2_pix_coordinate_arrays_pix()

    #======= Get CSPAD2x2 pedestals array, shaped as (185, 388, 2)
    peds_arr = calib.getCalibPars('pedestals', run)

    #======= Get data array from hdf5 dataset, shaped as (185, 388, 2)
    data_arr = hm.getDataSetForOneEvent(fname, dsname, event=0) - peds_arr
    
    #======= Convert shape from (185, 388, 2) to (2, 185, 388)    
    ord_arr  = calpars.data2x2ToTwo2x1(data_arr)

    #======= Compose and plot CSPAD2x2 image from coordinate and intensity arrays
    img2d = gg.getImageFromIndexArrays(X,Y,ord_arr)

    #======= Print for test purpose 
    calib.printCalibParsStatus()
    #print 'pedestals:\n', calib.getCalibPars('pedestals')
    print 'center:\n',    calib.getCalibPars('center')
    print 'tilt:\n',      calib.getCalibPars('tilt')
    print 'peds_arr.shape:', peds_arr.shape  # = (185, 388, 2)  
    print 'Get data array from file: ' + fname
    print 'data_arr.shape:', data_arr.shape
    print 'ord_arr.shape:', ord_arr.shape
    print 'img2d.shape:', img2d.shape

    #======= Plot image and spectrum
    my_range = (-10,40) # None
    gg.plotImageLarge(img2d, amp_range=my_range)        
    gg.plotSpectrum(img2d, amp_range=my_range)
    gg.show()
コード例 #4
0
def test_plot_for_cspad2x2_coords(calib_path='.', run_num=0):
    #calib_path  = '/reg/d/psdm/xpp/xpptut13/calib/CsPad2x2::CalibV1/XppGon.0:Cspad2x2.1/'
    #run_num   = 123

    #calib = CSPAD2x2CalibPars(calib_path, run_num)
    #coord = CSPAD2x2PixCoords(calib)
    coord = CSPAD2x2PixCoords()
    #coord.print_cspad2x2_geometry_pars()
    iX, iY = coord.get_cspad2x2_pix_coordinate_arrays_shapeed_as_data_pix()

    raw_arr = np.arange(185 * 388 * 2)  # np.zeros((sp.sects,sp.rows,sp.cols)
    raw_arr.shape = (185, 388, 2)

    img2d = gg.getImageFromIndexArrays(iX, iY, raw_arr)

    gg.plotImageLarge(img2d, amp_range=(-1, 185 * 388 * 2), figsize=(12, 11))
    gg.show()
コード例 #5
0
ファイル: CSPAD2x2Image.py プロジェクト: FilipeMaia/psdmrepo
def test_plot_for_cspad2x2_coords(calib_path='.', run_num=0) :
    #calib_path  = '/reg/d/psdm/xpp/xpptut13/calib/CsPad2x2::CalibV1/XppGon.0:Cspad2x2.1/'
    #run_num   = 123

    #calib = CSPAD2x2CalibPars(calib_path, run_num)
    #coord = CSPAD2x2PixCoords(calib)
    coord = CSPAD2x2PixCoords()
    #coord.print_cspad2x2_geometry_pars()
    iX,iY = coord.get_cspad2x2_pix_coordinate_arrays_shapeed_as_data_pix ()

    raw_arr = np.arange(185*388*2) # np.zeros((sp.sects,sp.rows,sp.cols)
    raw_arr.shape = (185,388,2)

    img2d = gg.getImageFromIndexArrays(iX,iY,raw_arr)

    gg.plotImageLarge(img2d, amp_range=(-1, 185*388*2), figsize=(12,11))
    gg.show()