Take a look at numpy.ix_
http://www.scipy.org/Numpy_Example_List_With_Doc#head-603de8bdb62d0412798c45fe1db0648d913c8a9c
This method creates the index array for you. You only have to specify
the coordinates in each dimesion.
Bernhard
On Oct 29, 8:46 am, Matthieu Brucher [EMAIL PROTECTED]
wrote:
Matthieu Brucher matthieu.brucher at gmail.com writes:
But if I have the coordinates of the points in an array, I have to reshape it
and then convert it into a list. Or convert it into a list and then convert it
to a tuple. I know that advanced indexing is useful, but here it is not
coherent.
But if I have the coordinates of the points in an array, I have to
reshape it
and then convert it into a list. Or convert it into a list and then
convert it
to a tuple. I know that advanced indexing is useful, but here it is not
coherent. tuples and lists should have the same result on
On 10/28/07, Matthieu Brucher [EMAIL PROTECTED] wrote:
Little correction, only c[(2,3)] gives me what I expect, not c[[2,3]],
which
is even stranger.
c[(2,3)] is the same as c[2,3] and obviously works as you expected.
Well, this is not indicated in the documentation.
This is true
In this case the constructor
tuple(arr)
should work just fine.
Sorry, I didn't know it could work (shame on me I should have tested).
--
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
Hi,
I'm trying to get an item in an array when I only have another array giving
the position.
For instance:
c = numpy.arange(0., 3*4*5).reshape((3,4,5))
c***(numpy.array((2,3), dtype=int))
[55, 56, 57, 58, 59]
I'm trying to figure what to put between c and ((2,3)). I supposed that the
take
Matthieu Brucher matthieu.brucher at gmail.com writes:
Little correction, only c[(2,3)] gives me what I expect, not c[[2,3]], which
is even stranger.
c[(2,3)] is the same as c[2,3] and obviously works as you expected.
c[[2,3]] is refered to as 'advanced indexing' in the numpy book.
It will
Little correction, only c[(2,3)] gives me what I expect, not c[[2,3]],
which
is even stranger.
c[(2,3)] is the same as c[2,3] and obviously works as you expected.
Well, this is not indicated in the documentation.
c[[2,3]] is refered to as 'advanced indexing' in the numpy book.
It