Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-09 Thread Friedrich Romstedt
2010/4/5 Ken Basye : >  I have two arrays, A and B, with the same shape.  I want to find the > highest values in A along some axis, then extract the corresponding > values from B. Maybe: def select(A, B, axis): # Extract incomplete index tuples: argmax = a.argmax(axis = axis)

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-07 Thread Vincent Schut
On 04/06/2010 03:22 PM, Ken Basye wrote: > From: Vincent Schut >> On 04/05/2010 06:06 PM, Keith Goodman wrote: >> >>> On Mon, Apr 5, 2010 at 8:44 AM, Ken Basye wrote: >>> snip > b[a.argmax(axis=0), range(3)] > >>> array([0, 4, 5]) >>> >> >> Which does not work anymore when your arra

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-06 Thread josef . pktd
On Tue, Apr 6, 2010 at 9:22 AM, Ken Basye wrote: > From: Vincent Schut > > On 04/05/2010 06:06 PM, Keith Goodman wrote: > > > On Mon, Apr 5, 2010 at 8:44 AM, Ken Basye wrote: > > > Hi Folks, > I have two arrays, A and B, with the same shape. I want to find the > highest values in A along some

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-06 Thread Ken Basye
From: Vincent Schut On 04/05/2010 06:06 PM, Keith Goodman wrote: On Mon, Apr 5, 2010 at 8:44 AM, Ken Basye wrote: Hi Folks, I have two arrays, A and B, with the same shape. I want to find the highest values in A along some axis, then extract the corresponding values from B. I can

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-06 Thread Vincent Schut
On 04/05/2010 06:06 PM, Keith Goodman wrote: > On Mon, Apr 5, 2010 at 8:44 AM, Ken Basye wrote: >> Hi Folks, >> I have two arrays, A and B, with the same shape. I want to find the >> highest values in A along some axis, then extract the corresponding >> values from B. I can get the highest val

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-05 Thread Keith Goodman
On Mon, Apr 5, 2010 at 8:44 AM, Ken Basye wrote: > Hi Folks, >  I have two arrays, A and B, with the same shape.  I want to find the > highest values in A along some axis, then extract the corresponding > values from B.  I can get the highest values in A with A.max(axis=0) and > the indices of the

[Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-05 Thread Ken Basye
Hi Folks, I have two arrays, A and B, with the same shape. I want to find the highest values in A along some axis, then extract the corresponding values from B. I can get the highest values in A with A.max(axis=0) and the indices of these highest values with A.argmax(axis=0). I'm trying to