interpolation=interp_method, dst=img_wrapped) pts0 = CpuGpuArray(pts0.cpu[::2000].copy()) trajectories = cpa_space.calc_trajectory(pts=pts0, mysign=1, **params_flow_int) pts_at_T = trajectories.cpu[-1] name = 'Warp {0}'.format(level + 1) # # plt.figure() plt.subplot(231) plt.imshow(img, cmap=pylab.gray()) plt.subplot(234) plt.imshow(img, cmap=pylab.gray()) plt.subplot(232) plt.imshow(img_wrapped.copy(), cmap=pylab.gray()) plt.subplot(235) plt.imshow(img_wrapped.copy(), cmap=pylab.gray()) nTrajs = trajectories.shape[1] for i in range(nTrajs): traj = trajectories.cpu[:, i] for h in [234, 235, 236]: plt.subplot(h) plt.plot(traj[:, 0], traj[:, 1]) if h == 234:
# params_flow_int.nTimeSteps *= 10 cell_idx = CpuGpuArray.zeros(len(pts), dtype=np.int32) cpa_space.calc_cell_idx(pts, cell_idx) cell_idx.gpu2cpu() print cell_idx img = cell_idx.cpu.reshape(cpa_space.x_dense_grid.shape[1:]) # img = pts.cpu[:,0].reshape(cpa_space.x_dense_grid.shape[1:]) plt.figure(1) of.plt.set_figure_size_and_location(0, 0, 800, 800) plt.clf() plt.subplot(131) plt.imshow(img[:, :, 0, 0], interpolation="None") plt.colorbar() v = CpuGpuArray.zeros_like(pts) cpa_space.calc_v(pts=pts, out=v) v.gpu2cpu() img = v.cpu[:, 1].reshape(cpa_space.x_dense_grid.shape[1:]) plt.subplot(132) plt.imshow(img[:, :, 0, 0], interpolation="None") plt.colorbar() # 1/0 print params_flow_int print '#pts=', len(pts)
# params_flow_int.nTimeSteps *= 10 cell_idx = CpuGpuArray.zeros(len(pts),dtype=np.int32) cpa_space.calc_cell_idx(pts,cell_idx) cell_idx.gpu2cpu() print cell_idx img=cell_idx.cpu.reshape(cpa_space.x_dense_grid.shape[1:]) # img = pts.cpu[:,0].reshape(cpa_space.x_dense_grid.shape[1:]) plt.figure(1) of.plt.set_figure_size_and_location(0,0,800,800) plt.clf() plt.subplot(131) plt.imshow(img[:,:,0,0],interpolation="None");plt.colorbar() v = CpuGpuArray.zeros_like(pts) cpa_space.calc_v(pts=pts,out=v) v.gpu2cpu() img=v.cpu[:,1].reshape(cpa_space.x_dense_grid.shape[1:]) plt.subplot(132) plt.imshow(img[:,:,0,0],interpolation="None");plt.colorbar() # 1/0 print params_flow_int print '#pts=',len(pts)
pts0=CpuGpuArray(pts0.cpu[::2000].copy()) trajectories=cpa_space.calc_trajectory(pts=pts0,mysign=1,**params_flow_int) pts_at_T=trajectories.cpu[-1] name='Warp {0}'.format(level+1) # # plt.figure() plt.subplot(231) plt.imshow(img,cmap=pylab.gray()) plt.subplot(234) plt.imshow(img,cmap=pylab.gray()) plt.subplot(232) plt.imshow(img_wrapped.copy(),cmap=pylab.gray()) plt.subplot(235) plt.imshow(img_wrapped.copy(),cmap=pylab.gray()) nTrajs = trajectories.shape[1] for i in range(nTrajs): traj = trajectories.cpu[:,i] for h in [234,235,236]: plt.subplot(h) plt.plot(traj[:,0],traj[:,1]) if h==234: