Re: [Numpy-discussion] Elementary Array Switching

2009-06-13 Thread Ian Mallett
It seems to be working now--I think my problem is elsewhere. Sorry... ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Indexing with integer ndarrays

2009-06-13 Thread Joe Kington
Thank you! That answered things quite nicely. My apologies for not finding the earlier discussion before sending out the question... Thanks again, -Joe On Sat, Jun 13, 2009 at 7:17 PM, Robert Kern wrote: > On Sat, Jun 13, 2009 at 19:11, Joe Kington wrote: > > Hi folks, > > > > This is probably

Re: [Numpy-discussion] Indexing with integer ndarrays

2009-06-13 Thread Robert Kern
On Sat, Jun 13, 2009 at 19:11, Joe Kington wrote: > Hi folks, > > This is probably a very simple question, but it has me stumped... > > I have an integer 2D array containing 3rd dimesion indicies that I'd like to > use to index values in a 3D array. > > Basically, I want the equivalent of: > >> out

[Numpy-discussion] Indexing with integer ndarrays

2009-06-13 Thread Joe Kington
Hi folks, This is probably a very simple question, but it has me stumped... I have an integer 2D array containing 3rd dimesion indicies that I'd like to use to index values in a 3D array. Basically, I want the equivalent of: > output = np.zeros((ny,nx)) > > for i in xrange(ny): > for j in x

[Numpy-discussion] More on doc-ing new functions

2009-06-13 Thread David Goldsmith
Are new functions automatically added to the Numpy Doc Wiki? In particular: 0) is the documentation itself (assuming there is some) added in such a way that it can be edited by Wiki users; and 1) is the name of the function automatically added to a "best guess" category in the Milestones? If

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread David Goldsmith
--- On Sat, 6/13/09, Charles R Harris wrote: > Some nitpicks: > > 3) Documentation is needed. In particular, I think it worth > mentioning that the number of bounds is taken from the > PyArrayIterObject, which isn't the most transparent > thing. OP's recognition of this need acknowledged, I ha

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread Charles R Harris
On Sat, Jun 13, 2009 at 12:29 PM, David Cournapeau wrote: > On Sun, Jun 14, 2009 at 3:00 AM, Charles R > Harris wrote: > > > > > > On Sat, Jun 13, 2009 at 7:46 AM, David Cournapeau > > wrote: > >> > >> Hi, > >> > >>I have cleaned up a bit the code, and would like to suggest the > >> inclusion

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread Charles R Harris
On Sat, Jun 13, 2009 at 12:35 PM, David Cournapeau wrote: > On Sun, Jun 14, 2009 at 3:22 AM, Charles R > Harris wrote: > > > 1) Since reference counting is such a pain, you should document that the > > constructor returns a new reference and that the PyArrayIterObject does > not > > need to have i

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread David Cournapeau
On Sun, Jun 14, 2009 at 3:22 AM, Charles R Harris wrote: > 1) Since reference counting is such a pain, you should document that the > constructor returns a new reference and that the PyArrayIterObject does not > need to have its reference count incremented before the call and that the > reference

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread David Cournapeau
On Sun, Jun 14, 2009 at 3:00 AM, Charles R Harris wrote: > > > On Sat, Jun 13, 2009 at 7:46 AM, David Cournapeau > wrote: >> >> Hi, >> >>    I have cleaned up a bit the code, and would like to suggest the >> inclusion of a neighborhood iterator for numpy. Stéfan took a look at it >> already, but i

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread Charles R Harris
On Sat, Jun 13, 2009 at 12:00 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Sat, Jun 13, 2009 at 7:46 AM, David Cournapeau < > da...@ar.media.kyoto-u.ac.jp> wrote: > > > > Hi, > > > >I have cleaned up a bit the code, and would like to suggest the > > inclusion of a neighbor

Re: [Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread Charles R Harris
On Sat, Jun 13, 2009 at 7:46 AM, David Cournapeau < da...@ar.media.kyoto-u.ac.jp> wrote: > > Hi, > >I have cleaned up a bit the code, and would like to suggest the > inclusion of a neighborhood iterator for numpy. Stéfan took a look at it > already, but it needs more eyeballs. It is a "subclass

[Numpy-discussion] Ready for review: PyArrayNeighIterObject, an iterator to iterate over a neighborhood in arbitrary arrays

2009-06-13 Thread David Cournapeau
Hi, I have cleaned up a bit the code, and would like to suggest the inclusion of a neighborhood iterator for numpy. Stéfan took a look at it already, but it needs more eyeballs. It is a "subclass" of PyArrayIterObject, and can be used to iterate over a neighborhood of a point (handling boundar

Re: [Numpy-discussion] finding index in an array...

2009-06-13 Thread josef . pktd
On Sat, Jun 13, 2009 at 5:51 AM, fred wrote: > Emmanuelle Gouillart a écrit : >> Hi Fred, > Hi Manue ;-) > >> here is another solution > A = np.arange(99).reshape((33,3) > mask = (A==np.array([0,1,2])) > np.nonzero(np.prod(mask, axis=1))[0] >> array([0] >> >> I found it to be less elega

Re: [Numpy-discussion] finding index in an array...

2009-06-13 Thread fred
Emmanuelle Gouillart a écrit : > Hi Fred, Hi Manue ;-) > here is another solution A = np.arange(99).reshape((33,3) mask = (A==np.array([0,1,2])) np.nonzero(np.prod(mask, axis=1))[0] > array([0] > > I found it to be less elegant than Josef's solution changing the dtype of > the arra

Re: [Numpy-discussion] finding index in an array...

2009-06-13 Thread Emmanuelle Gouillart
Hi Fred, here is another solution >>> A = np.arange(99).reshape((33,3) >>> mask = (A==np.array([0,1,2])) >>> np.nonzero(np.prod(mask, axis=1))[0] array([0] I found it to be less elegant than Josef's solution changing the dtype of the array, but it may be easier to understand if you're not very fa

Re: [Numpy-discussion] finding index in an array...

2009-06-13 Thread fred
josef.p...@gmail.com a écrit : > something like this should work to find rows with specific elements, > if I understand you correctly. You did ;-) > np.nonzero(A.view([('',float)]*3) == np.array((1,2,3),[('',float)]*3))[0] > > It creates an extra dimension, that needs to be removed with [0], but