ChileanVirtualObservatory / acalib

Advanced Computing for Astronomy Library
http://acalib.readthedocs.io/en/latest/
GNU General Public License v3.0
7 stars 13 forks source link

scale and get_flux uses python math and not numpy functions #1

Closed maray closed 8 years ago

maray commented 9 years ago

performing a python mathematical operation over a numpy array is terribly SLOW:

In [1]: import timeit In [2]: import numpy as np In [3]: a=np.random.random((10,100)) In [4]: f1=lambda :a.sum() In [5]: f2=lambda : sum(sum(a)) In [6]: %timeit f1() 100000 loops, best of 3: 2.5 µs per loop In [7]: %timeit f2() 10000 loops, best of 3: 33.4 µs per loop

So... please use numpy!