[Numpy-discussion] Understanding mgrid
Brad Malone
brad.malone@gmail....
Fri Sep 19 12:59:22 CDT 2008
Hi, I was wondering if someone could englighten me on what the geometrical
significance of numpy.mgrid is. I can play around with it and see trends in
the sizes and number of arrays, but why does it give the output that it
does? Looking at the example shown below, why does it return a matrix and
its transpose? Is this a representation of some geometrical grid? Does the
output imply some sort of connectivity? If so, how do you see it?
>>> mgrid[0:5,0:5]
array([[[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[2, 2, 2, 2, 2],
[3, 3, 3, 3, 3],
[4, 4, 4, 4, 4]],
<BLANKLINE>
[[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]]])
I have a cubic grid in 3D space that is spanned by 3 orthogonal vectors. Am
I able to generate this equivalent grid with mgrid somehow? If so, how is it
done? I am using mayavi and I need to be able to construct some arrays in
the same way that mgrid would have constructed them, so this is why I ask.
Thanks for the help,
Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080919/82c24417/attachment.html
More information about the Numpy-discussion
mailing list