def test_jungfrau_img_easy(): o = SegGeometryJungfrauV1() X, Y = o.get_seg_xy_maps_pix_with_offset() iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iY, iX, iX + iY) gg.plotImageLarge(img, amp_range=(0, 1500), figsize=(14, 6)) gg.show()
def test_2x2_img_easy() : pc2x2 = SegGeometryEpix100V1(use_wide_pix_center=False) X,Y = pc2x2.get_seg_xy_maps_pix_with_offset() iX, iY = (X+0.25).astype(int), (Y+0.25).astype(int) img = gg.getImageFromIndexArrays(iX,iY,iX+iY) gg.plotImageLarge(img, amp_range=(0, 1500), figsize=(8,10)) gg.show()
def test_2x2_img_easy(): w = SegGeometryEpixHR2x2V1(use_wide_pix_center=False) X, Y = w.get_seg_xy_maps_pix_with_offset() iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iY, iX, iX + 2 * iY) gg.plotImageLarge(img, amp_range=(0, 750), figsize=(10, 8)) gg.show()
def test_mask(width=0, edge_rows=5, edge_cols=5): o = segment_one_v2 X, Y = o.get_seg_xy_maps_pix_with_offset() mask = o.pixel_mask_array(width=width, edge_rows=edge_rows, edge_cols=edge_cols) iX, iY = (X+0.25).astype(int), (Y+0.25).astype(int) img = gg.getImageFromIndexArrays(iY,iX,mask) gg.plotImageLarge(img, amp_range=(-1, 2), figsize=FIGSIZE_INCH) gg.show()
def test_mask(mbits=0o377): pc2x1 = SegGeometryMatrixV1() X, Y = pc2x1.get_seg_xy_maps_pix_with_offset() mask = pc2x1.pixel_mask_array(mbits) iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iX, iY, mask) gg.plotImageLarge(img, amp_range=(-1, 2), figsize=(8, 10)) gg.show()
def test_img_easy(): pc2x1 = SegGeometryMatrixV1() #X,Y = pc2x1.get_seg_xy_maps_pix() X, Y = pc2x1.get_seg_xy_maps_pix_with_offset() iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iX, iY, iX + iY) gg.plotImageLarge(img, amp_range=(0, 1100), figsize=(8, 10)) gg.show()
def test_mask(mbits=0o377, width=5): o = segment_one X, Y = o.get_seg_xy_maps_pix_with_offset() mask = o.pixel_mask_array(mbits, width) iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iX, iY, mask) gg.plotImageLarge(img, amp_range=(-1, 2), figsize=(8, 10)) gg.show()
def test_2x2_mask(width=0, wcenter=0, edge_rows=3, edge_cols=6, center_rows=2, center_cols=4): pc2x2 = SegGeometryEpix100V1(use_wide_pix_center=False) X, Y = pc2x2.get_seg_xy_maps_pix_with_offset() mask = 1+pc2x2.pixel_mask_array(width, wcenter, edge_rows, edge_cols, center_rows, center_cols)#, dtype=DTYPE_MASK, **kwa) iX, iY = (X+0.25).astype(int), (Y+0.25).astype(int) img = gg.getImageFromIndexArrays(iX,iY,mask) gg.plotImageLarge(img, amp_range=(0, 2), figsize=(11,10)) gg.show()
def test_2x2_mask(mbits=0o377) : pc2x2 = SegGeometryEpix100V1(use_wide_pix_center=False) X, Y = pc2x2.get_seg_xy_maps_pix_with_offset() mask = pc2x2.pixel_mask_array(mbits) mask[mask==0]=3 iX, iY = (X+0.25).astype(int), (Y+0.25).astype(int) img = gg.getImageFromIndexArrays(iX,iY,mask) gg.plotImageLarge(img, amp_range=(-1, 2), figsize=(8,10)) gg.show()
def test_jungfrau_mask(mbits=0o377, width=1): o = SegGeometryJungfrauV1() X, Y = o.get_seg_xy_maps_pix_with_offset() mask = o.pixel_mask_array(mbits, width) mask[mask == 0] = 4 iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iY, iX, mask) gg.plotImageLarge(img, amp_range=(-1, 4), figsize=(14, 6)) gg.show()
def test_img_easy(): o = segment_one_v2 X, Y = o.get_seg_xy_maps_pix() xmin, xmax, ymin, ymax = X.min(), X.max(), Y.min(), Y.max() Xoff, Yoff = X-xmin, Y-ymin iX, iY = (Xoff+0.25).astype(int), (Yoff+0.25).astype(int) img = gg.getImageFromIndexArrays(iY,iX,X+2*Y) gg.plotImageLarge(img, amp_range=(xmin+2*ymin, xmax+2*ymax), figsize=FIGSIZE_INCH) #gg.move(20,20) gg.show()
def test_2x1_mask(mbits=0o377) : pc2x1 = SegGeometryCspad2x1V1(use_wide_pix_center=False) X, Y = pc2x1.get_seg_xy_maps_pix_with_offset() mask = pc2x1.pixel_mask_array(mbits) print('mask:\n%s' % mask) print('mask.shape: ', mask.shape) iX, iY = (X+0.25).astype(int), (Y+0.25).astype(int) img = gg.getImageFromIndexArrays(iX,iY,mask) gg.plotImageLarge(img, amp_range=(-1, 2), figsize=(8,10)) gg.show()
def test_jungfrau_img_easy(): o = jungfrau_front X, Y = o.get_seg_xy_maps_pix() xmin, xmax, ymin, ymax = X.min(), X.max(), Y.min(), Y.max() Xoff, Yoff = X - xmin, ymax - Y iX, iY = (Xoff + 0.25).astype(int), (Yoff + 0.25).astype(int) img = gg.getImageFromIndexArrays(iY, iX, X + 3 * Y) gg.plotImageLarge(img, amp_range=(xmin + 3 * ymin, xmax + 3 * ymax), figsize=(14, 7)) gg.show()
def test_mask(sg, width=6, wcenter=4): logging.getLogger('matplotlib').setLevel(logging.WARNING) import psana.pyalgos.generic.Graphics as gg X, Y = sg.get_seg_xy_maps_pix_with_offset() mask = 1 + sg.pixel_mask_array(width=width, wcenter=wcenter) #mask[mask==0]=3 iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iX, iY, mask) sh = sg.shape() h_in = 9. w_in = h_in * sh[0] / sh[1] * 1.2 gg.plotImageLarge(img, amp_range=(-1, 2), figsize=(w_in, h_in)) gg.show()
def test_jungfrau_mask(width=0, wcenter=0, edge_rows=3, edge_cols=6, center_rows=2, center_cols=4): o = jungfrau_one X, Y = o.get_seg_xy_maps_pix_with_offset() mask = 1 + o.pixel_mask_array(width, wcenter, edge_rows, edge_cols, center_rows, center_cols) mask[mask == 0] = 4 iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iY, iX, mask) gg.plotImageLarge(img, amp_range=(0, 2), figsize=(14, 7)) gg.show()
def test_2x1_mask(mbits=0o7, width=0, wcenter=0, edge_rows=10, edge_cols=6, center_cols=4): pc2x1 = SegGeometryCspad2x1V1(use_wide_pix_center=False) X, Y = pc2x1.get_seg_xy_maps_pix_with_offset() mask = 1 + pc2x1.pixel_mask_array(mbits, width, wcenter, edge_rows, edge_cols, center_cols) s = '\n mask:\n%s' % str(mask)\ + '\n mask.shape: %s' % str(mask.shape) logger.info(s) iX, iY = (X + 0.25).astype(int), (Y + 0.25).astype(int) img = gg.getImageFromIndexArrays(iX, iY, mask) gg.plotImageLarge(img, amp_range=(0, 2), figsize=(7, 10)) gg.show()