Skip to content

Instantly share code, notes, and snippets.

@DanHickstein
Created March 11, 2016 16:17
Show Gist options
  • Save DanHickstein/9b985b903f9062831f40 to your computer and use it in GitHub Desktop.
Save DanHickstein/9b985b903f9062831f40 to your computer and use it in GitHub Desktop.
import numpy as np
import abel
import matplotlib.pyplot as plt
import time
# nps = np.logspace(1,9,12)
nps = [10,20,2e9]
print nps
times1 = []
ax = plt.subplot(111)
ax.set_xlabel('Number of total pixels (NxN)')
ax.set_ylabel('Time (sec)')
ax.set_xscale('log')
ax.set_yscale('log')
ax.margins(y=0.2, x=0.2)
plt.ion()
plt.show()
for npix in nps:
n = np.sqrt(npix)
print '%i\t %i \t\t'%(n, npix),
n = (int(n)//2)*2 + 1
# IM = abel.tools.analytical.sample_image(n=n, name="dribinski")
IM = np.random.random((n,n))
t1 = time.time()
abel.transform(IM, direction="inverse", method="hansenlaw", verbose=False)['transform']
t2 = time.time() - t1
times1.append(t2)
print '%.4f'%t2
plt.plot(npix,t2, 'bo')
ax.relim()
ax.autoscale_view()
plt.draw()
plt.pause(0.1)
ax.plot(nps,times1, color='b')
plt.ioff()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment