Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-20 Thread Chao YUE
Dear Thouis, I take some time to check, before I tried with cython, I tried the np.interp first, and very luckily, it's exeactly what I need. And with the old written by me, it spend 20 seconds, now it's 0.2 seconds! Thanks a lot to all you guys. Chao On Mon, Nov 19, 2012 at 3:08 PM, Thouis

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-19 Thread Thouis (Ray) Jones
On Sat, Nov 17, 2012 at 8:28 AM, Chao YUE chaoyue...@gmail.com wrote: Dear all, I need to make a linear contrast of the 2D numpy array data from an interval to another, the approach is: I have another two list: base target, then I check for each ndarray element data[i,j], if base[m] =

[Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Chao YUE
Dear all, I need to make a linear contrast of the 2D numpy array data from an interval to another, the approach is: I have another two list: base target, then I check for each ndarray element data[i,j], if base[m] = data[i,j] = base[m+1], then it will be linearly converted to be in the

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Benjamin Root
On Saturday, November 17, 2012, Chao YUE wrote: Dear all, I need to make a linear contrast of the 2D numpy array data from an interval to another, the approach is: I have another two list: base target, then I check for each ndarray element data[i,j], if base[m] = data[i,j] = base[m+1],

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Chao YUE
Yes, both the base and target are ascending. Thanks! Chao On Sat, Nov 17, 2012 at 2:40 PM, Benjamin Root ben.r...@ou.edu wrote: On Saturday, November 17, 2012, Chao YUE wrote: Dear all, I need to make a linear contrast of the 2D numpy array data from an interval to another, the