Gael Varoquaux | 5 Aug 06:42
Favicon

Re: Modify surf output (axes, scaling)

On Tue, Aug 05, 2008 at 12:02:59AM +0200, Thomas Königstein wrote:
>    I'm on Windows XP home edition, SP2, I got this mayavi version from
>    [1]pythonxy.com. And yes I'd like to try a easier-to-use version of mayavi
>    :)

Well, unfortunately I am not sure there is a newer binary for windows.
Did you check that the latest pythonxy did not have a more recent binary?
In two weeks we are going to release a fresh new EPD (Enthought Python
Distribution) that will have a bran new and shiny version of mayavi. In
the mean time you might have to do with what you have. I am certainly
totaly unable to build binaries for windows.

>    In terms of usability, my problem with mayavi is that most of the time I'm
>    trying to figure out how certain methods/functions/modules work by looking
>    at their __doc__ and their subclasses via autocomplete or dir(...); that
>    way I learned for example some of numpy or PIL. But in mayavi, there are
>    always dozens of subclasses, which have no obvious use for me...
>    enable_traits, configure_traits, tno_can_delete_me, .... most of them
>    probably aren't meant to be used by the "end-user", but still they are
>    there and confuse me :/

Are you using ipython? If you have a recent-enough version, it should
have traits-aware tab-completion, just hitting the tab key will give you
a list of meaningful attributes. I am not too sure when this came in
ipython, though looking at pythonxy I see it also has an ice-age release
of ipython. Well, I guess this is another thing that will improve in the
next release of EPD.

In the mean time, you can get updated documentation on the web, on
http://code.enthought.com/projects/mayavi/docs/development/html/
I'll change this URL real soon to
http://code.enthought.com/projects/mayavi/docs/development/mayavi/html/
by the way.

This is documentation for the developmenet version of mayavi, so some
things may not apply :).

>    > >    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?

>    > That is what the extent keyword argument is for. Just give two extents
>    > located in different regions. Does that make sens?

>    Well, yes, but my problem was that I have an existing plot in the scene,
>    and I want to move it after it has been created. With a Surface, this is
>    possible by clicking on Data2DSource->Data->Origin in the scene explorer,
>    but there is no equivalent for Vectors. There is a "Whole Extent" and
>    "Update Extent" field, but changing their values has no effect for me.

You could use a transform data filter to tune this interactively. Maybe I
should be using this to implement the extent keyword... So many things to
do.

>    The extent keyword works, however. I'm just not sure, how :) what does
>    each of the six values do? I guess they construct three points which
>    define a cuboid where the vectors are stuffed into, but I couldn't quite
>    get it right yet.. extend(0,0,0,0,0) for example does nothing.

Yes, indeed, there is a check to check that you are not putting some
dimensions at zero. Without this check there used to be funny things
happening with flat objects. You could use extent like this:
extent = (0, 1, 0, 1, 0, 1) for one object
extent = (-1, 0, 0, 1, 0, 1) for the other.

>    And another thing: in my example, I used quiver3d(*array(...)). The
>    asterisk somehow turns an array of n arrays into n arrays, as it seems.
>    But whereas quiver3d(*array(...)) works, a=*array(....) does not. Also,
>    quiver3d(*array(...), extent=(..)) does not work. This is not a problem
>    with mayavi, it's just my lack of knowledge concerning numpy. I must have
>    read the *array thing somewhere, but now I have forgotten where that was,
>    and googling for * isn't so easy :)

Well there is a cleaner way of transforming one n*3 array in three
arrays: a[0, :], a[1, :], a[2, :]. What you are doing is actually
transforming one list-like argument to a function in several arguments to
the same function made of the elements of that list. This will work only
on function calls.

HTH,

Gaël

Gmane