![](https://secure.gravatar.com/avatar/d41fa6e1fe29e6c5c5821b5a3f31f190.jpg?s=120&d=mm&r=g)
Hi all, linspace is useful for one-dimensional objects. Is there something similar for surfaces ? I would like to build a uniform mesh on a cube (-R,R)^3 I mean collocation points uniformly distributed on each side of the cube. Nils
![](https://secure.gravatar.com/avatar/beebe07772844149dcd47e23e5276e72.jpg?s=120&d=mm&r=g)
On Thu, 16 Mar 2006, Nils Wagner wrote:
Hi all,
linspace is useful for one-dimensional objects. Is there something similar for surfaces ? I would like to build a uniform mesh on a cube (-R,R)^3 I mean collocation points uniformly distributed on each side of the cube.
What about numpy.mgrid? Arnd
![](https://secure.gravatar.com/avatar/d41fa6e1fe29e6c5c5821b5a3f31f190.jpg?s=120&d=mm&r=g)
Arnd Baecker wrote:
On Thu, 16 Mar 2006, Nils Wagner wrote:
Hi all,
linspace is useful for one-dimensional objects. Is there something similar for surfaces ? I would like to build a uniform mesh on a cube (-R,R)^3 I mean collocation points uniformly distributed on each side of the cube.
What about numpy.mgrid?
Arnd
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
That hits the spot, but how can I distribute N**2 points in the open domain, that is points should not lie on the edges of the cube. Please can you fill the gaps in X,Y,Z = mgrid[ ..., ..., ...] Thanks in advance Nils
![](https://secure.gravatar.com/avatar/d41fa6e1fe29e6c5c5821b5a3f31f190.jpg?s=120&d=mm&r=g)
Arnd Baecker wrote:
On Thu, 16 Mar 2006, Nils Wagner wrote:
Hi all,
linspace is useful for one-dimensional objects. Is there something similar for surfaces ? I would like to build a uniform mesh on a cube (-R,R)^3 I mean collocation points uniformly distributed on each side of the cube.
What about numpy.mgrid?
Arnd
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
X,Y = mgrid[linspace(-0.4,0.4,10),linspace(-0.4,0.4,10)] Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib64/python2.4/site-packages/numpy/lib/index_tricks.py",
I tried line 89, in __getitem__ step = key[k].step AttributeError: 'numpy.ndarray' object has no attribute 'step' Nils
![](https://secure.gravatar.com/avatar/49df8cd4b1b6056c727778925f86147a.jpg?s=120&d=mm&r=g)
Nils Wagner wrote:
X,Y = mgrid[linspace(-0.4,0.4,10),linspace(-0.4,0.4,10)]
Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib64/python2.4/site-packages/numpy/lib/index_tricks.py", line 89, in __getitem__ step = key[k].step AttributeError: 'numpy.ndarray' object has no attribute 'step'
mgrid doesn't take sequences it takes "slice notation" mgrid[-0.4:0.4:10j, -0.4:0.4:10j] should work -Travis
participants (3)
-
Arnd Baecker
-
Nils Wagner
-
Travis Oliphant