import tomograpy # object obj = tomograpy.centered_cubic_map(3, 128, fill=1.) # number of images n = 20 # reshape object for 4d model obj4 = obj.reshape(obj.shape + (1, )).repeat(n, axis=-1) obj4.header['NAXIS'] = 4 obj4.header['NAXIS4'] = obj4.shape[3] obj4.header['CRVAL4'] = 0. # data radius = 200 a = tomograpy.fov(obj.header, radius) data = tomograpy.centered_stack(a, 128, n_images=n, radius=radius, max_lon=np.pi) data[:] = np.zeros(data.shape) # projection t = time.time() data = tomograpy.projector4d(data, obj4) print("projection time : " + str(time.time() - t)) # backprojection x0 = obj4.copy() x0[:] = 0. t = time.time() x0 = tomograpy.backprojector4d(data, x0) print("backprojection time : " + str(time.time() - t))
#!/usr/bin/env python import time import numpy as np import tomograpy # object obj = tomograpy.centered_cubic_map(3, 128, fill=1.) # number of images n = 20 # reshape object for 4d model obj4 = obj.reshape(obj.shape + (1,)).repeat(n, axis=-1) obj4.header['NAXIS'] = 4 obj4.header['NAXIS4'] = obj4.shape[3] obj4.header['CRVAL4'] = 0. # data radius = 200 a = tomograpy.fov(obj.header, radius) data = tomograpy.centered_stack(a, 128, n_images=n, radius=radius, max_lon=np.pi) data[:] = np.zeros(data.shape) # projection t = time.time() data = tomograpy.projector4d(data, obj4) print("projection time : " + str(time.time() - t)) # backprojection x0 = obj4.copy() x0[:] = 0. t = time.time() x0 = tomograpy.backprojector4d(data, x0) print("backprojection time : " + str(time.time() - t))
time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime((t))) for t in dates ] for i in xrange(len(data.header)): data.header[i]['DATE_OBS'] = dates[i] data = tomograpy.solar.sort_data_array(data) # projection t = time.time() data = tomograpy.projector4d(data, obj4, obstacle="sun") print("projection time : " + str(time.time() - t)) # backprojection x0 = obj4.copy() x0[:] = 0. t = time.time() x0 = tomograpy.backprojector4d(data, x0, obstacle="sun") print("backprojection time : " + str(time.time() - t)) # model kwargs = { 'obj_rmin': 1., #'obj_rmax':1.3, 'mask_negative': False, 'dt_min': 100 } P, D, obj_mask, data_mask = tomograpy.models.stsrt(data, obj, **kwargs) # hyperparameters hypers = (1e-1, 1e-1, 1e-1, 1e3) # test time for one projection b = data.ravel() t = time.time() u = P.T * b
dates = np.concatenate(2 * (dates, )) dates = [time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime((t))) for t in dates] for i in xrange(len(data.header)): data.header[i]['DATE_OBS'] = dates[i] data = tomograpy.solar.sort_data_array(data) # projection t = time.time() data = tomograpy.projector4d(data, obj4, obstacle="sun") print("projection time : " + str(time.time() - t)) # backprojection x0 = obj4.copy() x0[:] = 0. t = time.time() x0 = tomograpy.backprojector4d(data, x0, obstacle="sun") print("backprojection time : " + str(time.time() - t)) # model kwargs = {'obj_rmin':1., #'obj_rmax':1.3, 'mask_negative':False, 'dt_min':100} P, D, obj_mask, data_mask = tomograpy.models.stsrt(data, obj, **kwargs) # hyperparameters hypers = (1e-1, 1e-1, 1e-1, 1e3) # test time for one projection b = data.ravel() t = time.time() u = P.T * b print("time with index grouping : %f" % ((time.time() - t))) # inversion t = time.time()