[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

[Numpy-discussion] Assignment function with a signature similar to take?

2012-11-17 Thread Eric Moore
Is there a function that operates like 'take' but does assignment? Specifically that takes indices and an axis? As far as I can tell no such function exists. Is there any particular reason? One can fake such a thing by doing (code untested): s = len(a.shape)*[np.s_[:]] s[axis] = np.s_[1::2]

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Nathaniel Smith
On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks for the explanations. For either case, I was expecting to get float32 as a resulting data type. Since, float32 is large enough to contain the result. I am wondering if changing casting rule this way, requires a

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Gökhan Sever
On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith n...@pobox.com wrote: On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks for the explanations. For either case, I was expecting to get float32 as a resulting data type. Since, float32 is large enough to

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Olivier Delalleau
2012/11/17 Gökhan Sever gokhanse...@gmail.com On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith n...@pobox.com wrote: On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks for the explanations. For either case, I was expecting to get float32 as a resulting

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Charles R Harris
On Sat, Nov 17, 2012 at 1:00 PM, Olivier Delalleau sh...@keba.be wrote: 2012/11/17 Gökhan Sever gokhanse...@gmail.com On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith n...@pobox.com wrote: On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks for the

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Benjamin Root
On Saturday, November 17, 2012, Charles R Harris wrote: On Sat, Nov 17, 2012 at 1:00 PM, Olivier Delalleau sh...@keba.bejavascript:_e({}, 'cvml', 'sh...@keba.be'); wrote: 2012/11/17 Gökhan Sever gokhanse...@gmail.com javascript:_e({}, 'cvml', 'gokhanse...@gmail.com'); On Sat, Nov