API Reference for Enthought Tool Suite 3.2.0
A simple wrapper around tvtk.tools.mlab suitable for MayaVi2! This is meant to be used from the embedded Python interpreter in MayaVi2 or from IPython with the "-wthread" switch.
There are several test functions at the end of this file that are illustrative to look at.
application = get_application()
mayavi = None
Creates an axes for the current data.
color -- The color triplet, eg: (1., 0., 0.)
xlabel -- the label of the x axis, default: ''
ylabel -- the label of the y axis, default: ''
zlabel -- the label of the z axis, default: ''
object -- the object for which we create the axes.
Clear the current figure.
Adds a colorbar for the color mapping of the given object.
If the object has scalar data, the scalar color mapping is represented. Elsewhere the vector color mapping is represented, if available. If no object is specified, the first object with a color map in the scene is used.
object -- Optional object to get the vector lut from
title -- The title string
orientation -- Can be 'horizontal' or 'vertical'
Plots iso-surfaces for a 3D volume of data suplied as arguments.
contour3d(scalars, ...) contour3d(scalarfield, ...)
scalars -- A 3D array giving the value of the scalar on a grid.
- scalarfield -- VTK data object with scalar field data, such as
- created by scalarfield.
name -- The name of the vtk object created. Default: 'Contour3D'
- transpose_scalars -- If the additional argument
- transpose_scalars is passed, then the input scalar array is suitably transposed. By default transpose_scalars is True so that the array is in the correct format that VTK expects. However, a transposed array is not contiguous and thus a copy is made, this also means that any changes to the users input array will will not be reflected in the renderered object (provided you know how to do this). Thus, sometimes users might want to provide already transposed data suitably formatted. In these cases one should set transpose_scalars to False. Default value: True
- contours -- Integer/list specifying number/list of
- iso-surfaces. Specifying 0 shows no contours. Specifying a list of values will only give the requested contours asked for. Default: 3
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the shape of the scalars
- transparent -- Boolean to make the opacity of the isosurfaces depend
- on the scalar. Default: True
Plots the contours of a surface using grid spaced data supplied as 2D arrays.
Function signatures:
contour_surf(z, scalars=z, ...) contour_surf(surf_object, ...) contour_surf(x, y, z, scalars=z, ...)
If only one array z is passed the x and y arrays are assumed to be made of the indices of z. z is the elevation matrix. If no scalars argument is passed the contours are contour lines of the elevation, elsewhere they are contour lines of the scalar array. A surf object can also be passed in which case the function adds contours to the existing surf.
If you are running from IPython this will start up mayavi for you! This returns the current running MayaVi script instance.
Return a handle to the current figure.
Applies the Glyph mayavi module to the given VTK data object.
Allows one to view a 2D Numeric array as an image. This works best for very large arrays (like 1024x1024 arrays).
arr -- Array to be viewed.
interpolate -- Boolean to interpolate the data in the image.
Applies the IsoSsurface mayavi module to the given VTK data object.
Creates an outline for the current data.
- object -- the object for which we create the outline
- (default None).
color -- The color triplet, eg: ( 1., 0., 0.)
Draws lines between points.
x -- x coordinates of the points of the line
y -- y coordinates of the points of the line
z -- z coordinates of the points of the line
color -- color of the line. Default: (1., 0., 0.)
use_tubes -- Enables the drawing of the lines as tubes. Default: True
radius -- radius of the tubes created. Default: 0.01
name -- The name of the vtk object created. Default: 'Plot3D'
Plots glyphs (like points) at the position of the supplied data.
points3d(scalardata, ...) points3d(x, y, z...) points3d(x, y, z, s, ...) points3d(x, y, z, f, ...)
If only one positional argument is passed, it should be VTK data object with scalar data.
If only 3 arrays x, y, z all the points are drawn with the same size and color
If 4 positional arguments are passed the last one can be an array s or a callable f that gives the size and color of the glyph.
- scalardata -- VTK data object with scalar data, such as created
- by scalarscatter.
x -- x coordinates of the points.
y -- y coordinates of the points.
z -- z coordinates of the points.
s -- array giving the color and size of the glyphs (optional).
- f -- callable that returns the scalar associated with the points
- as a function of position.
name -- The name of the vtk object created. Default: 'Points3D'
- mode -- This should be one of ['2d' (2d arrows),
- 'arrow', 'cone', 'cylinder', 'sphere', 'cube', 'point'] and depending on what is passed shows an appropriate glyph. It defaults to a sphere.
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
scalars -- The scalars used to display the color of the glyphs.
- color -- The color of the glyphs. Overrides the scalar array.
- Default: (1., 0., 0.).
- autoscale -- Autoscale the size of the glyph.
- Default: True
scale_factor -- Default 1
Plots glyphs (like arrows) indicating the direction of the vectors for a 3D volume of data supplied as arguments.
quiver3d(vectordata, ...) quiver3d(u, v, w, ...) quiver3d(x, y, z, u, v, w, ...) quiver3d(x, y, z, f, ...)
If only one positional argument is passed, it should be VTK data object with vector data.
If only 3 arrays u, v, w are passed the x, y and z arrays are assumed to be made from the indices of vectors.
If 4 positional arguments are passed the last one must be a callable, f, that returns vectors.
- vectordata -- VTK data object with vector data, such as created
- by vectorscatter of vectorfield.
x -- x coordinates of the points of the mesh (optional).
y -- y coordinates of the points of the mesh (optional).
z -- z coordinates of the points of the mesh (optional).
u -- x coordinnate of the vector field
v -- y coordinnate of the vector field
w -- z coordinnate of the vector field
- f -- callable that is used to build the vector field (only if 4
- positional arguments are passed).
name -- The name of the vtk object created. Default: 'Quiver3D'
- mode -- This should be one of ['2d' (2d arrows),
- 'arrow', 'cone', 'cylinder', 'sphere', 'cube', 'point'] and depending on what is passed shows an appropriate glyph. It defaults to a 3d arrow.
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
- scalars -- The scalars used to display the color of the glyphs.
- Defaults to the norm of the vectors.
- color -- The color of the glyphs in the absence of scalars.
- Default: (1., 0., 0.)
- autoscale -- Autoscale the size of the glyph.
- Default: True
scale_factor -- Default 1
Save the current scene. The output format are deduced by the extension to filename. Possibilities are png, jpg, bmp, tiff, ps, eps, pdf, rib (renderman), oogl (geomview), iv (OpenInventor), vrml, obj (wavefront)
If an additional size (2-tuple) argument is passed the window is resized to the specified size in order to produce a suitably sized output image. Please note that when the window is resized, the window may be obscured by other widgets and the camera zoom is not reset which is likely to produce an image that does not reflect what is seen on screen.
Any extra keyword arguments are passed along to the respective image format's save method.
Adds a colorbar for the scalar color mapping of the given object.
If no object is specified, the first object with scalar data in the scene is used.
title -- The title string
orientation -- Can be 'horizontal' or 'vertical'
Creates a scalar field data.
scalarfield(s, ...) scalarfield(x, y, z, s, ...) scalarfield(x, y, z, f, ...)
If only 1 array s is passed the x, y and z arrays are assumed to be made from the indices of the s array.
If the x, y and z arrays are passed they are supposed to have been generated by numpy.mgrid. The function builds a scalar field assuming the points are regularily spaced.
x -- x coordinates of the points of the mesh (optional).
y -- y coordinates of the points of the mesh (optional).
z -- z coordinates of the points of the mesh (optional).
s -- scalar values.
- f -- callable that is used to build the scalar field (only if 4
- positional arguments are passed).
name -- The name of the vtk object created. Default: 'Scalar field'
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
Creates scattered scalar data.
scalarscatter(s, ...) scalarscatter(x, y, z, s, ...) scalarscatter(x, y, z, f, ...)
If only 1 array s is passed the x, y and z arrays are assumed to be made from the indices of vectors.
If 4 positional arguments are passed the last one must be an array s, or acallable, f, that returns an array.
x -- x coordinates of the points of the mesh (optional).
y -- y coordinates of the points of the mesh (optional).
z -- z coordinates of the points of the mesh (optional).
s -- scalar value
- f -- callable that is used to build the scalar data (only if 4
- positional arguments are passed).
name -- The name of the vtk object created. Default: 'Scattered scalars'
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
Applies the Streamline mayavi module to the given VTK data object.
Plots a surface using grid spaced data supplied as 2D arrays.
surf(z, scalars=z, ...) surf(x, y, z, scalars=z, ...)
If only one array z is passed the x and y arrays are assumed to be made of the indices of z. z is the elevation matrix. If no scalars argument is passed the color of the surface also represents the z matrix. Setting the scalars argument to None prevents this.
x -- x coordinates of the points of the mesh (optional).
y -- y coordinates of the points of the mesh (optional).
- z -- A 2D array giving the elevation of the mesh.
- Also will work if z is a callable which supports x and y arrays as the arguments, but x and y must then be supplied.
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
- scalars -- An array of the same shape as z that gives the color of the
- surface. This can also be a function that takes x and y as arguments.
- represention -- can be 'surface', 'wireframe', 'points', or 'mesh'
- Default is 'surface'
color -- The color of the mesh in the absence of scalars.
name -- The name of the vtk object created. Default is "Surf"
Show a large random array.
Create a fancy looking mesh (example taken from octaviz).
Create a simple sphere and test the mesh.
Generates and shows a Caffeine molecule.
Generates a pretty set of lines.
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.
Adds a text on the figure.
x -- x position on the screen of the origin of the text, default: 0
y -- y position on the screen of the origin of the text, default: 0
text -- The text, default: ''
color -- The color triplet, eg: ( 1., 0., 0.)
size -- The size, default: 1
Creates a title for the figure.
text -- The text of the title, default: ''
color -- The color triplet, eg: ( 1., 0., 0.)
size -- The size, default: 1
Adds a colorbar for the vector color mapping of the given object.
If no object is specified, the first object with vector data in the scene is used.
object -- Optional object to get the vector lut from
title -- The title string
orientation -- Can be 'horizontal' or 'vertical'
Creates a vector field data.
vectorfield(u, v, w, ...) vectorfield(x, y, z, u, v, w, ...) vectorfield(x, y, z, f, ...)
If only 3 arrays u, v, w are passed the x, y and z arrays are assumed to be made from the indices of the u, v, w arrays.
If the x, y and z arrays are passed they are supposed to have been generated by numpy.mgrid. The function builds a vector field assuming the points are regularily spaced.
x -- x coordinates of the points of the mesh (optional).
y -- y coordinates of the points of the mesh (optional).
z -- z coordinates of the points of the mesh (optional).
u -- x coordinnate of the vector field
v -- y coordinnate of the vector field
w -- z coordinnate of the vector field
- f -- callable that is used to build the vector field (only if 4
- positional arguments are passed).
name -- The name of the vtk object created. Default: 'Vector field'
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
scalars -- The scalars associated to the vectors. Defaults to none.
- transpose_vectors -- If the additional argument
- transpose_vectors is passed, then the input vectors array is suitably transposed. By default transpose_vectors is True so that the array is in the correct format that VTK expects. However, a transposed array is not contiguous and thus a copy is made, this also means that any changes to the users input array will will not be reflected in the renderered object (provided you know how to do this). Thus, sometimes users might want to provide already transposed data suitably formatted. In these cases one should set transpose_vectors to False. Default value: True
Applies the Vectors mayavi module to the given VTK data object.
Creates scattered vector data.
vectorscatter(u, v, w, ...) vectorscatter(x, y, z, u, v, w, ...) vectorscatter(x, y, z, f, ...)
If only 3 arrays u, v, w are passed the x, y and z arrays are assumed to be made from the indices of vectors.
If 4 positional arguments are passed the last one must be a callable, f, that returns vectors.
x -- x coordinates of the points of the mesh (optional).
y -- y coordinates of the points of the mesh (optional).
z -- z coordinates of the points of the mesh (optional).
u -- x coordinnate of the vector field
v -- y coordinnate of the vector field
w -- z coordinnate of the vector field
- f -- callable that is used to build the vector field (only if 4
- positional arguments are passed).
name -- The name of the vtk object created. Default: 'Scattered vector'
- extent -- [xmin, xmax, ymin, ymax, zmin, zmax]
- Default is the x, y, z arrays extents.
scalars -- The scalars associated to the vectors. Defaults to none.
Creates a set of axes if there isn't already one, and sets the x label
Creates a set of axes if there isn't already one, and sets the y label
Creates a set of axes if there isn't already one, and sets the z label
| Local name | Refers to |
|---|---|
| ArraySource | enthought.mayavi.sources.array_source.ArraySource |
| Axes | enthought.mayavi.modules.axes.Axes |
| FilterBase | enthought.mayavi.filters.filter_base.FilterBase |
| Glyph | enthought.mayavi.modules.glyph.Glyph |
| Group | enthought.traits.ui.group.Group |
| HasTraits | enthought.traits.has_traits.HasTraits |
| IMAYAVI | enthought.mayavi.services.IMAYAVI |
| Instance | enthought.traits.trait_types.Instance |
| IsoSurface | enthought.mayavi.modules.iso_surface.IsoSurface |
| Item | enthought.traits.ui.item.Item |
| Mayavi | enthought.mayavi.app.Mayavi |
| Module | enthought.mayavi.core.module.Module |
| ModuleManager | enthought.mayavi.core.module_manager.ModuleManager |
| scipy | scipy |
| Source | enthought.mayavi.core.source.Source |
| Streamline | enthought.mayavi.modules.streamline.Streamline |
| Surface | enthought.mayavi.modules.surface.Surface |
| Text | enthought.mayavi.modules.text.Text |
| tvtk | enthought.tvtk.tvtk.tvtk |
| Vectors | enthought.mayavi.modules.vectors.Vectors |
| View | enthought.traits.ui.view.View |
| VTKDataSource | enthought.mayavi.sources.vtk_data_source.VTKDataSource |
© Copyright 2002-2009 Enthought, Inc.