[Numpy-discussion] Data cube optimization for combination
Jose Miguel Ibáñez
ppmime at gmail.com
Tue Mar 6 07:00:38 EST 2012
Hello everyone,
does anyone know of an efficient implementation (maybe using
numpy.where statement) of the next code for data cube (3d array)
combining ?
import numpy as np
def combine( )
cube = np.random.rand(32,2048,2048)
result = np.zeros([2048,2048], np.float32)
for ii in range(2048):
for jj in range(2048):
result[, ii, jj] = np.sqrt((cube[:,ii, jj])).sum()
It takes long time to run, however,
>> result = np.median(cube,0)
only around one second ! where is the point ? any suggestions ?
Thanks !
More information about the NumPy-Discussion
mailing list