Esempio n. 1
0
def test_epix100a():
    """ Test test_epix100a geometry table
    """
    basedir = '/reg/g/psdm/detector/alignment/cspad/calib-cxi-ds1-2014-05-15/'
    fname_geometry = basedir + 'calib/CsPad::CalibV1/CxiDs1.0:Cspad.0/geometry/2-end.data'
    fname_data = basedir + 'cspad-arr-cxid2714-r0023-lysozyme-rings.txt'

    #basedir = '/reg/neh/home1/dubrovin/LCLS/GeometryCalib/calib-xpp-Epix100a-2014-11-05/'
    #fname_geometry = basedir + 'calib/Epix100a::CalibV1/NoDetector.0:Epix100a.0/geometry/0-end.data'
    #fname_data     = basedir + 'epix100a-ndarr-ave-clb-xppi0614-r0073.dat'

    geometry = GeometryAccess(fname_geometry, 0177777)
    amp_range = (-4, 10)

    iX, iY = geometry.get_pixel_coord_indexes()

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data,
                                                               dtype=np.float)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape
    img = img_from_pixel_arrays(iX, iY, W=arr)

    axim = gg.plotImageLarge(img, amp_range=amp_range)
    gg.move(500, 10)
    gg.show()
Esempio n. 2
0
def test_cspad_xy_at_z():
    """ Test cspad geometry table
    """
    ## 'CxiDs1.0:Cspad.0)' or 'DscCsPad'
    basedir = '/reg/g/psdm/detector/alignment/cspad/calib-cxi-camera1-2014-09-24/'
    fname_geometry = basedir + '2016-06-03-geometry-cxi06216-r25-camera1-z175mm.txt'
    fname_data = basedir + '2016-06-03-chun-cxi06216-0025-DscCsPad-max.txt'

    geometry = GeometryAccess(fname_geometry, 0377)

    # get pixel coordinate index arrays:
    xyc = xc, yc = 1000, 1000
    #iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=xyc)
    #iX, iY = geometry.get_pixel_coord_indexes(do_tilt=True)
    #iX, iY = geometry.get_pixel_xy_inds_at_z(zplane=None, xy0_off_pix=xyc)
    iX, iY = geometry.get_pixel_xy_inds_at_z(zplane=150000)

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data,
                                                               dtype=np.float)

    #print 'arr.shape=', arr.shape
    arr.shape = (32, 185, 388)

    #ave, rms = arr.mean(), arr.std()
    #amp_range = (ave-rms, ave+3*rms)
    amp_range = (0, 1000)
    print 'amp_range', amp_range

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape
    img = img_from_pixel_arrays(iX, iY, W=arr)

    axim = gg.plotImageLarge(img, amp_range=amp_range)
    gg.move(500, 10)
    gg.show()
Esempio n. 3
0
def test_epix100a() :
    """ Test test_epix100a geometry table
    """
    basedir = '/reg/g/psdm/detector/alignment/cspad/calib-cxi-ds1-2014-05-15/'    
    fname_geometry = basedir + 'calib/CsPad::CalibV1/CxiDs1.0:Cspad.0/geometry/2-end.data'
    fname_data     = basedir + 'cspad-arr-cxid2714-r0023-lysozyme-rings.txt'    

    #basedir = '/reg/neh/home1/dubrovin/LCLS/GeometryCalib/calib-xpp-Epix100a-2014-11-05/'    
    #fname_geometry = basedir + 'calib/Epix100a::CalibV1/NoDetector.0:Epix100a.0/geometry/0-end.data'
    #fname_data     = basedir + 'epix100a-ndarr-ave-clb-xppi0614-r0073.dat'    

    geometry = GeometryAccess(fname_geometry, 0177777)
    amp_range = (-4,10)

    iX, iY = geometry.get_pixel_coord_indexes()

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data, dtype=np.float) 

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape 
    img = img_from_pixel_arrays(iX,iY,W=arr)

    axim = gg.plotImageLarge(img,amp_range=amp_range)
    gg.move(500,10)
    gg.show()
Esempio n. 4
0
def test_cspad2x2():
    """ Test cspad2x2 geometry table
    """
    ## MecTargetChamber.0:Cspad2x2.1
    basedir = '/reg/neh/home1/dubrovin/LCLS/CSPad2x2Alignment/calib-cspad2x2-01-2013-02-13/'
    fname_geometry = basedir + 'calib/CsPad2x2::CalibV1/MecTargetChamber.0:Cspad2x2.1/geometry/0-end.data'
    fname_data = basedir + 'cspad2x2.1-ndarr-ave-meca6113-r0028.dat'

    ## MecTargetChamber.0:Cspad2x2.2
    #basedir = '/reg/neh/home1/dubrovin/LCLS/CSPad2x2Alignment/calib-cspad2x2-02-2013-02-13/'
    #fname_geometry = basedir + 'calib/CsPad2x2::CalibV1/MecTargetChamber.0:Cspad2x2.2/geometry/0-end.data'
    #fname_data     = basedir + 'cspad2x2.2-ndarr-ave-meca6113-r0028.dat'

    geometry = GeometryAccess(fname_geometry, 0377)
    amp_range = (0, 15000)

    # get pixel coordinate index arrays:
    #xyc = xc, yc = 1000, 1000
    #iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=xyc)

    iX, iY = geometry.get_pixel_coord_indexes(do_tilt=True)

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data,
                                                               dtype=np.float)
    arr.shape = (185, 388, 2)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape
    img = img_from_pixel_arrays(iX, iY, W=arr)

    axim = gg.plotImageLarge(img, amp_range=amp_range)
    gg.move(500, 10)
    gg.show()
Esempio n. 5
0
def test_plot_cspad(geometry, fname_data, amp_range=(0, 0.5)):
    """ The same test as previous, but use get_pixel_coord_indexes(...) method
    """
    #rad1 =  93
    #rad2 = 146
    rad1 = 655
    rad2 = 670

    # get pixel coordinate index arrays:
    xc, yc = 1000, 1000
    xyc = xc, yc  # None

    #iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=None)
    iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=xyc, do_tilt=True)

    ixo, iyo = geometry.point_coord_indexes(xy0_off_pix=xyc, do_tilt=True)
    print 'Detector origin indexes ixo, iyo:', ixo, iyo

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data,
                                                               dtype=np.float)
    arr.shape = (4, 8, 185, 388)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape

    arr.shape = iX.shape
    img = img_from_pixel_arrays(iX, iY, W=arr)

    xyc_ring = (yc, xc)
    axim = gg.plotImageLarge(img, amp_range=amp_range)
    gg.drawCircle(axim, xyc_ring, rad1, linewidth=1, color='w', fill=False)
    gg.drawCircle(axim, xyc_ring, rad2, linewidth=1, color='w', fill=False)
    gg.drawCenter(axim, xyc_ring, rad1, linewidth=1, color='w')
    gg.move(500, 10)
    gg.show()
Esempio n. 6
0
def test_cspad_xy_at_z() :
    """ Test cspad geometry table
    """
    ## 'CxiDs1.0:Cspad.0)' or 'DscCsPad' 
    basedir = '/reg/g/psdm/detector/alignment/cspad/calib-cxi-camera1-2014-09-24/'    
    fname_geometry = basedir + '2016-06-03-geometry-cxi06216-r25-camera1-z175mm.txt'
    fname_data     = basedir + '2016-06-03-chun-cxi06216-0025-DscCsPad-max.txt'    

    geometry = GeometryAccess(fname_geometry, 0377)

    # get pixel coordinate index arrays:
    xyc = xc, yc = 1000, 1000
    #iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=xyc)
    #iX, iY = geometry.get_pixel_coord_indexes(do_tilt=True)
    #iX, iY = geometry.get_pixel_xy_inds_at_z(zplane=None, xy0_off_pix=xyc)
    iX, iY = geometry.get_pixel_xy_inds_at_z(zplane=150000)

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data, dtype=np.float) 

    #print 'arr.shape=', arr.shape
    arr.shape= (32,185,388)

    #ave, rms = arr.mean(), arr.std()
    #amp_range = (ave-rms, ave+3*rms)
    amp_range = (0, 1000)
    print 'amp_range', amp_range

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape 
    img = img_from_pixel_arrays(iX,iY,W=arr)

    axim = gg.plotImageLarge(img,amp_range=amp_range)
    gg.move(500,10)
    gg.show()
Esempio n. 7
0
def test_cspad2x2() :
    """ Test cspad2x2 geometry table
    """
    ## MecTargetChamber.0:Cspad2x2.1
    basedir = '/reg/neh/home1/dubrovin/LCLS/CSPad2x2Alignment/calib-cspad2x2-01-2013-02-13/'    
    fname_geometry = basedir + 'calib/CsPad2x2::CalibV1/MecTargetChamber.0:Cspad2x2.1/geometry/0-end.data'
    fname_data     = basedir + 'cspad2x2.1-ndarr-ave-meca6113-r0028.dat'    

    ## MecTargetChamber.0:Cspad2x2.2 
    #basedir = '/reg/neh/home1/dubrovin/LCLS/CSPad2x2Alignment/calib-cspad2x2-02-2013-02-13/'    
    #fname_geometry = basedir + 'calib/CsPad2x2::CalibV1/MecTargetChamber.0:Cspad2x2.2/geometry/0-end.data'
    #fname_data     = basedir + 'cspad2x2.2-ndarr-ave-meca6113-r0028.dat'    

    geometry = GeometryAccess(fname_geometry, 0377)
    amp_range = (0,15000)

    # get pixel coordinate index arrays:
    #xyc = xc, yc = 1000, 1000
    #iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=xyc)

    iX, iY = geometry.get_pixel_coord_indexes(do_tilt=True)

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data, dtype=np.float) 
    arr.shape= (185,388,2)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape 
    img = img_from_pixel_arrays(iX,iY,W=arr)

    axim = gg.plotImageLarge(img,amp_range=amp_range)
    gg.move(500,10)
    gg.show()
Esempio n. 8
0
def test_plot_cspad(geometry, fname_data, amp_range=(0,0.5)) :
    """ The same test as previous, but use get_pixel_coord_indexes(...) method
    """
    #rad1 =  93
    #rad2 = 146
    rad1 = 655
    rad2 = 670

    # get pixel coordinate index arrays:
    xc, yc = 1000, 1000
    xyc = xc, yc # None 

    #iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=None)
    iX, iY = geometry.get_pixel_coord_indexes(xy0_off_pix=xyc, do_tilt=True)

    ixo, iyo = geometry.point_coord_indexes(xy0_off_pix=xyc, do_tilt=True)
    print 'Detector origin indexes ixo, iyo:', ixo, iyo

    root, ext = os.path.splitext(fname_data)
    arr = np.load(fname_data) if ext == '.npy' else np.loadtxt(fname_data, dtype=np.float) 
    arr.shape= (4,8,185,388)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape

    arr.shape = iX.shape
    img = img_from_pixel_arrays(iX, iY, W=arr)

    xyc_ring = (yc, xc)
    axim = gg.plotImageLarge(img,amp_range=amp_range)
    gg.drawCircle(axim, xyc_ring, rad1, linewidth=1, color='w', fill=False) 
    gg.drawCircle(axim, xyc_ring, rad2, linewidth=1, color='w', fill=False) 
    gg.drawCenter(axim, xyc_ring, rad1, linewidth=1, color='w') 
    gg.move(500,10)
    gg.show()
Esempio n. 9
0
def test_xyz_maps() :

    w = SegGeometryMatrixV1()
    w.print_maps_seg_um()

    titles = ['X map','Y map']
    #for i,arr2d in enumerate([w.x_pix_arr,w.y_pix_arr]) :
    for i,arr2d in enumerate( w.get_seg_xy_maps_pix() ) :
        amp_range = (arr2d.min(), arr2d.max())
        gg.plotImageLarge(arr2d, amp_range=amp_range, figsize=(10,5), title=titles[i])
        gg.move(200*i,100*i)

    gg.show()
Esempio n. 10
0
def test_xyz_maps():

    w = SegGeometryMatrixV1()
    w.print_maps_seg_um()

    titles = ['X map', 'Y map']
    #for i,arr2d in enumerate([w.x_pix_arr,w.y_pix_arr]) :
    for i, arr2d in enumerate(w.get_seg_xy_maps_pix()):
        amp_range = (arr2d.min(), arr2d.max())
        gg.plotImageLarge(arr2d,
                          amp_range=amp_range,
                          figsize=(10, 5),
                          title=titles[i])
        gg.move(200 * i, 100 * i)

    gg.show()
Esempio n. 11
0
def test_mask_quad(geometry, mbits) :
    """ Tests geometry acess methods of the class GeometryAccess object for CSPAD quad
    """
    ## get index arrays
    iX, iY = geometry.get_pixel_coord_indexes('QUAD:V1', 1, pix_scale_size_um=None, xy0_off_pix=None, do_tilt=True)

    # get intensity array
    arr = geometry.get_pixel_mask('QUAD:V1', 1, mbits)
    arr.shape = (8,185,388)
    amp_range = (-1,2)
 
    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape 
    img = img_from_pixel_arrays(iX, iY, W=arr, vbase=0.5)

    gg.plotImageLarge(img,amp_range=amp_range)
    gg.move(500,10)
    gg.show()
Esempio n. 12
0
def test_plot_quad(geometry) :
    """ Tests geometry acess methods of the class GeometryAccess object for CSPAD quad
    """
    ## get index arrays
    iX, iY = geometry.get_pixel_coord_indexes('QUAD:V1', 1, pix_scale_size_um=None, xy0_off_pix=None, do_tilt=True)

    # get intensity array
    arr = tig.cspad_nparr(n2x1=iX.shape[0])
    arr.shape = (8,185,388)
    amp_range = (0,185+388)
 
    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape 
    img = img_from_pixel_arrays(iX,iY,W=arr)

    gg.plotImageLarge(img,amp_range=amp_range)
    gg.move(500,10)
    gg.show()
Esempio n. 13
0
def test_mask_quad(geometry, mbits):
    """ Tests geometry acess methods of the class GeometryAccess object for CSPAD quad
    """
    ## get index arrays
    iX, iY = geometry.get_pixel_coord_indexes('QUAD:V1',
                                              1,
                                              pix_scale_size_um=None,
                                              xy0_off_pix=None,
                                              do_tilt=True)

    # get intensity array
    arr = geometry.get_pixel_mask('QUAD:V1', 1, mbits)
    arr.shape = (8, 185, 388)
    amp_range = (-1, 2)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape
    img = img_from_pixel_arrays(iX, iY, W=arr, vbase=0.5)

    gg.plotImageLarge(img, amp_range=amp_range)
    gg.move(500, 10)
    gg.show()
Esempio n. 14
0
def test_plot_quad(geometry):
    """ Tests geometry acess methods of the class GeometryAccess object for CSPAD quad
    """
    ## get index arrays
    iX, iY = geometry.get_pixel_coord_indexes('QUAD:V1',
                                              1,
                                              pix_scale_size_um=None,
                                              xy0_off_pix=None,
                                              do_tilt=True)

    # get intensity array
    arr = tig.cspad_nparr(n2x1=iX.shape[0])
    arr.shape = (8, 185, 388)
    amp_range = (0, 185 + 388)

    print 'iX, iY, W shape:', iX.shape, iY.shape, arr.shape
    img = img_from_pixel_arrays(iX, iY, W=arr)

    gg.plotImageLarge(img, amp_range=amp_range)
    gg.move(500, 10)
    gg.show()
Esempio n. 15
0
def test_img_default():
    """ Test default image
    """
    axim = gg.plotImageLarge(img_default())
    gg.move(500, 10)
    gg.show()
Esempio n. 16
0
def test_img_default() :
    """ Test default image
    """
    axim = gg.plotImageLarge( img_default() )
    gg.move(500,10)
    gg.show()