Re: [Numpy-discussion] return index of maximum value in an array easily?

2013-01-11 Thread Sebastian Berg
On Sat, 2013-01-12 at 00:26 +0100, Chao YUE wrote: > Hi, > > I don't know how others think about this. Like you point out, one can > use > np.nonzero(a==np.max(a)) as a workaround. > > For the second point, in case I have an array: > a = np.arange(24.).reshape(2,3,4) > > suppose I want to find

Re: [Numpy-discussion] return index of maximum value in an array easily?

2013-01-11 Thread Chao YUE
Hi, I don't know how others think about this. Like you point out, one can use np.nonzero(a==np.max(a)) as a workaround. For the second point, in case I have an array: a = np.arange(24.).reshape(2,3,4) suppose I want to find the index for maximum value of each 2X3 array along the 3rd dimension, w

Re: [Numpy-discussion] return index of maximum value in an array easily?

2013-01-11 Thread Nathaniel Smith
On Thu, Jan 10, 2013 at 9:40 AM, Chao YUE wrote: > Dear all, > > Are we going to consider returning the index of maximum value in an array > easily > without calling np.argmax and np.unravel_index consecutively? This does seem like a good thing to support somehow. What would a good interface look

[Numpy-discussion] phase unwrapping (1d)

2013-01-11 Thread Neal Becker
np.unwrap was too slow, so I rolled by own (in c++). I wanted to be able to handle the case of unwrap (arg (x1) + arg (x2)) Here, phase can change by more than 2pi. I came up with the following algorithm, any thoughts? In the following, y is normally set to pi. o points to output i points to i