API Reference for Enthought Tool Suite 3.0.1
A module that provides Matlab like 3d visualization functionality.
The general idea is shamelessly stolen from the high-level API provided by Octaviz. Some of the test cases and demos are also translated from there!
The implementation provided here is object oriented and each visualization capability is implemented as a class that has traits. So each of these may be configured. Each visualization class derives (ultimately) from MLabBase which is responsible for adding/removing its actors into the render window. The classes all require that the RenderWindow be a pyface.tvtk.scene.Scene instance (this constraint can be relaxed if necessary later on).
This module offers the following broad class of functionality:
To see nice examples of all of these look at the test_* functions at the end of this file. Here is a quick example that uses these test functions:
>>> from enthought.tvtk.tools import mlab >>> f = mlab.figure() >>> mlab.test_surf(f) # Create a spherical harmonic. >>> f.pop() # Remove it. >>> mlab.test_molecule(f) # Show a caffeine molecule. >>> f.renwin.reset_zoom() # Scale the view. >>> f.pop() # Remove this. >>> mlab.test_lines(f) # Show pretty lines. >>> f.clear() # Remove all the stuff on screen.
Set this to False to not use LOD Actors.
USE_LOD_ACTOR = True
Simple helper function that returns a usable figure.
outline : bool (default: True)
If True, create an outline bounding box along with an axes marker for the scene.
browser : bool (default, True)
If True, creates an IVTK scene with an embedded PipelineBrowser. If False, does not create it.
Creates a surface given regularly spaced values of x, y and the corresponding z as arrays. Also works if z is a function. Currently works only for regular data - can be enhanced later.
x -- Array of x points (regularly spaced)
y -- Array if y points (regularly spaced)
z -- A 2D array for the x and y points with x varying fastest and y next. Also will work if z is a callable which supports x and y arrays as the arguments.
warp -- If true, warp the data to show a 3D surface (default = 1).
scale -- Scale the x, y and z axis as per passed values. Defaults to [1.0, 1.0, 1.0].
make_actor -- also create actors suitably (default True)
args -- additional positional arguments for func() (default is empty)
kwargs -- a dict of additional keyword arguments for func() (default is empty)
Given x, y, and z co-ordinates made using numpy.mgrid and optional scalars. This function returns triangles and points corresponding to a mesh formed by them.
A list of x coordinate values formed using numpy.mgrid.
A list of y coordinate values formed using numpy.mgrid.
A list of z coordinate values formed using numpy.mgrid.
Scalars to associate with the points.
Samples a function at an array of ordered points (with equal spacing) and returns an array of scalars as per VTK's requirements for a structured points data set, i.e. x varying fastest and y varying next.
xa -- Array of x points.
ya -- Array if y points.
func -- function of x, and y to sample.
args -- additional positional arguments for func() (default is empty)
kwargs -- a dict of additional keyword arguments for func() (default is empty)
Returns a with any ones from the shape of a removed
Show a large random array.
Generates a pretty set of lines.
Create a fancy looking mesh (example taken from octaviz).
Create a simple sphere and test the mesh.
Generates and shows a Caffeine molecule.
Test Surf with a simple collection of points.
A very pretty picture of spherical harmonics translated from the octaviz example.
Test Surf on regularly spaced co-ordinates like MayaVi.
Test for simple triangle mesh.
| Local name | Refers to |
|---|---|
| Any | enthought.traits.trait_types.Any |
| Bool | enthought.traits.trait_types.Bool |
| Float | enthought.traits.trait_types.Float |
| GUI | enthought.pyface.gui.GUI |
| HasTraits | enthought.traits.has_traits.HasTraits |
| Instance | enthought.traits.trait_types.Instance |
| Int | enthought.traits.trait_types.Int |
| List | enthought.traits.trait_types.List |
| numpy | numpy |
| Str | enthought.traits.trait_types.Str |
| Trait | enthought.traits.traits.Trait |
| tvtk | enthought.tvtk.tvtk.tvtk |
| TVTKBase | enthought.tvtk.tvtk_base.TVTKBase |
| vtk_color_trait | enthought.tvtk.tvtk_base.vtk_color_trait |
© Copyright 2002-2008 Enthought, Inc.