4 Aug 18:16
Re: Modify surf output (axes, scaling)
From: Thomas Königstein <thkoe002@...>
Subject: Re: Modify surf output (axes, scaling)
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-08-04 16:16:42 GMT
Subject: Re: Modify surf output (axes, scaling)
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-08-04 16:16:42 GMT
Wow, thanks for your elaborate reply. I'm just afraid the code you supplied doesn't work for me as w doesn't have a "add_filter" method. enthought.mayavi.version.version == 2.1.1 for me. I'll try around with the alternatives you mentioned when I have more time.
And the other thing, with the quiver3d plot, I just want to move a plot spatially. For example:
from enthought.mayavi.mlab import quiver3d;from numpy import random;a=quiver3d(*array([random.random(40) for i in range(6)]));b=quiver3d(*array([random.random(40) for i in range(6)]))
gives me two "bunches" of vectors, both at the same location. How can I now seperate one from the other?
Thanks again for the quick reply, cheers
Thomas
On Mon, Aug 4, 2008 at 17:13, Gael Varoquaux <gael.varoquaux <at> normalesup.org> wrote:
On Mon, Aug 04, 2008 at 04:52:40PM +0200, Thomas Königstein wrote:What is your version of mayavi? With recent-enough versions of mayavi,
> About the original topic: how do I apply the filter via shell?
> enthought.mayavi.filters.poly_data_normals.Instance(s) seems to create an
> instance of the filter, but it dooesn't show up in the scene explorer.
you can do this:
out = mlab.pipeline.polydatanormals(src)
where src is the object you want to apply your filter on, and out the
output of the filter. Note that in mayavi2, version 3.0, that we are
going to release next week, this has changed to
pipeline.poly_data_normals
Now you will have to build the pipeline yourself if you want control on
it. The surf command boils down to:
P = mlab.pipeline
src = P.array2dsource(z)
w = P.warpscalar(src)
s = P.suface(w)
Each of these steps take keyword arguments to control their properties,
you can have a look at there docstring to find these out.
Alternatively, if you have a really old version of mayavi, you can add
retrieve the adding functions manually:
from enthought.mayavi.tools.sources import array2dsource
from enthought.mayavi.tools.filters import warpscalar
from enthought.mayavi.tools.modules import surface
Now in your oldish version of mayavi, you don't have PolyDataNormals
accessible in that way, so you have do to it the manual way:
from enthought.mayavi.filters.poly_data_normals import PolyDataNormals
p = PolyDataNormals()
w.add_filter(p)
and then you can do s = P.surface(p).
As you can see this is a part of mlab that got a fair amount of work
lately. This is alos the reason why it wasn't documented. I have only
become happy with the implementation this coming release.I don't know. Prabhu may know.
> And on another note: Can I somehow change the behavior of the camera/mouse
> interaction? I'd like the system to rorate only about two axes, the
> vertical and the horizontal one. In other words, the axis which is
> separately activated when I press ctrl should be disabled when moving the
> viewport with the mouse normally. Is that possible?
Are you looking for the extent keyword argument? I am not too sure what
> Also, how can I move a glyph-plot relative to the origin of the scene (for
> example, from enthought.mayavi.mlab import quiver3d;from numpy import
> array;quiver3d(*array(range(6))) )? Moving surf-plots works by choosig
> Array2DSource->Data->Origin. Is there a equivalent way to do this via
> shell or explorer for a quiver3d plot?
you want to do, here.
HTH,
Gaël
_______________________________________________
Enthought-dev mailing list
Enthought-dev-oRDGkvazHdacsI7C1d+pp9BPR1lH4CV8@public.gmane.org
https://mail.enthought.com/mailman/listinfo/enthought-dev
_______________________________________________ Enthought-dev mailing list Enthought-dev@... https://mail.enthought.com/mailman/listinfo/enthought-dev
RSS Feed