def test_map_shape(): obj = tomograpy.centered_cubic_map(3, cube_shape0) data = tomograpy.centered_stack(tomograpy.fov(obj, d), data_shape0, n_images=n_images) # projection pj_times = np.empty(len(cube_shapes) + 1) pj_times[0] = time.time() for i, s in enumerate(cube_shapes): obj = tomograpy.centered_cubic_map(3, s) tomograpy.projector(data, obj) pj_times[i + 1] = time.time() pj_times = pj_times[1:] - pj_times[:-1] # backprojection bpj_times = np.empty(len(cube_shapes) + 1) bpj_times[0] = time.time() for i, s in enumerate(cube_shapes): obj = tomograpy.centered_cubic_map(3, s) tomograpy.backprojector(data, obj) bpj_times[i + 1] = time.time() bpj_times = bpj_times[1:] - bpj_times[:-1] # pretty print text = '' text += 'Cube shape' text += ''.join([' & ' + str(s) + "$^3$" for s in cube_shapes]) text += ' \\\\ \n' + 'Projection (s)' text += ''.join([' & %2.2f' % pjt for pjt in pj_times]) text += ' \\\\ \n' + 'Backprojection (s)' text += ''.join([' & %2.2f' % bpjt for bpjt in bpj_times]) text += ' \\\\ \n' print text
def test_cores(): obj = tomograpy.centered_cubic_map(3, cube_shape0) data = tomograpy.centered_stack(tomograpy.fov(obj, d), data_shape0, n_images=n_images) # projection pj_times = np.empty(nthread_max + 1) pj_times[0] = time.time() for nt in xrange(nthread_max): tomograpy.projector(data, obj, nthread=nt + 1) pj_times[nt + 1] = time.time() pj_times = pj_times[1:] - pj_times[:-1] # backprojection bpj_times = np.empty(nthread_max + 1) bpj_times[0] = time.time() for nt in xrange(nthread_max): tomograpy.backprojector(data, obj, nthread=nt + 1) bpj_times[nt + 1] = time.time() bpj_times = bpj_times[1:] - bpj_times[:-1] # pretty print text = '' text += 'Cores' text += ''.join([' & ' + str(i + 1) for i in xrange(nthread_max)]) text += ' \\\\ \n' + 'Projection (s)' text += ''.join([' & %2.2f' % pjt for pjt in pj_times]) text += ' \\\\ \n' + 'Backprojection (s)' text += ''.join([' & %2.2f' % bpjt for bpjt in bpj_times]) text += ' \\\\ \n' print text
#!/usr/bin/env python import numpy as np import os import copy import time import tomograpy import fitsarray as fa # data path = os.path.join(os.getenv('HOME'), 'data', 'tomograpy., '171dec08') obsrvtry = 'STEREO_A' time_window = ['2008-12-01T00:00:00.000', '2008-12-15T00:00:00.000'] time_step = 8 * 3600. # one image every time_step seconds data = tomograpy.solar.read_data(path, bin_factor=8, obsrvtry=obsrvtry, time_window=time_window, time_step=time_step) # map cube = tomograpy.centered_cubic_map(3, 128, fill=0.) t = time.time() cube = tomograpy.backprojector(data, cube, obstacle="sun") 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.) # data radius = 200. a = tomograpy.fov(obj.header, radius) data = tomograpy.centered_stack(a, 128, n_images=17, radius=200., max_lon=np.pi) # projection t = time.time() data = tomograpy.projector(data, obj, obstacle="sun") print("projection time : " + str(time.time() - t)) # backprojection obj0 = tomograpy.centered_cubic_map(3, 128, fill=0.) t = time.time() obj0 = tomograpy.backprojector(data, obj0, obstacle="sun") print("backprojection time : " + str(time.time() - t))
#!/usr/bin/env python import time import numpy as np import tomograpy # object object_header = tomograpy.centered_cubic_map_header(3, 128) obj = tomograpy.simu.object_from_header(object_header, fill=1.) # data radius = 200. a = tomograpy.fov(object_header, radius) data = tomograpy.centered_stack(a, 128, n_images=60, radius=200., max_lon=np.pi) # projection t = time.time() data = tomograpy.projector(data, obj) print("projection time : " + str(time.time() - t)) # backprojection t = time.time() data[:] = 1. obj0 = tomograpy.simu.object_from_header(object_header, fill=0.) obj0 = tomograpy.backprojector(data, obj0) print("backprojection time : " + str(time.time() - t)) obj1 = tomograpy.simu.object_from_header(object_header, fill=0.) obj1 = tomograpy.backprojector(data, obj1)