예제 #1
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:
    xyc = xc, yc = 500, 500# None 

    #rows, cols = geometry.get_pixel_coord_indexes(xy0_off_pix=None)
    rows, cols = 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)
    logger.info('Detector origin indexes ixo:%d iyo:%d' % (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)

    logger.info('shapes rows: %s cols: %s weight: %s' % (str(rows.shape), str(cols.shape), str(arr.shape)))

    arr.shape = rows.shape
    img = img_from_pixel_arrays(rows, cols, W=arr)

    rcc_ring = (iyo, ixo)
    axim = gg.plotImageLarge(img,amp_range=amp_range)
    gg.drawCircle(axim, rcc_ring, rad1, linewidth=1, color='w', fill=False) 
    gg.drawCircle(axim, rcc_ring, rad2, linewidth=1, color='w', fill=False) 
    gg.drawCenter(axim, rcc_ring, rad1, linewidth=1, color='w') 
    gg.move(500,10)
    gg.show()
예제 #2
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()