titer = 4 NITER = 512 maxint = 3 voxelsize = 1e-6 energy = 5 # Load a 3D object beta = dxchange.read_tiff( 'data/test-beta-128.tiff').astype('float32')[::2, ::2, ::2] delta = dxchange.read_tiff( 'data/test-delta-128.tiff').astype('float32')[::2, ::2, ::2] # Create object. obj = objects.Object(beta, delta, voxelsize) # Create probe prb = objects.Probe(objects.gaussian(15, rin=0.8, rout=1.0), maxint=maxint) # Detector parameters det = objects.Detector(63, 63) # Define rotation angles theta = np.linspace(0, 2*np.pi, 400).astype('float32') # Scanner positions scanax, scanay = objects.scanner3(theta, beta.shape, 10, 10, margin=[ prb.size, prb.size], offset=[0, 0], spiral=1) # tomography data shape tomoshape = [len(theta), obj.shape[0], obj.shape[2]] # Class solver slv = solver_gpu.Solver(prb, scanax, scanay, theta, det, voxelsize, energy, tomoshape) def signal_handler(sig, frame):
# Load a 3D object. beta = dxchange.read_tiff( 'data/test-beta-128.tiff').astype('float32') delta = dxchange.read_tiff( 'data/test-delta-128.tiff').astype('float32') obj = objects.Object(beta, delta, voxelsize) det = objects.Detector(128, 128) theta = np.linspace(0, 2*np.pi, 720).astype('float32') tomoshape = [len(theta), obj.shape[0], obj.shape[2]] if(sys.argv[1] == "True"): print('compute regular') maxint = 10 prb = objects.Probe(gaussian(16, rin=0.8, rout=1.0), maxint=maxint) scan, scanax, scanay = scanner3(theta, beta.shape, 6, 6, margin=[ prb.size, prb.size], offset=[0, 0], spiral=1) slv = solver_gpu.Solver(prb, scanax, scanay, theta, det, voxelsize, energy, tomoshape) # data psis = slv.fwd_tomo(obj.complexform) data = np.abs(slv.fwd_ptycho(slv.exptomo(psis)))**2 # rec tau = 1e-16 alpha = 1e-16 h = np.ones(tomoshape, dtype='complex64', order='C') psi = np.ones(tomoshape, dtype='complex64', order='C') lamd = np.zeros(psi.shape, dtype='complex64', order='C') phi = np.zeros([3, *obj.shape], dtype='complex64', order='C')