On Thu, Jul 30, 2009 at 12:16:40AM -0400, Tom Foutz wrote:
> How can one plot tensors in mayavi?� I have eigenvalues/eigenvectors, as
> well as a 3x3 matrix.� Any pointers?
As long as you are using a Mayavi version > 3 (that is: Mayavi2, version
3.x, ... confusing?), I can help you.
I have attached a script that displays random tensors.
Ga�l
from enthought.mayavi import mlab
from enthought.tvtk.api import tvtk
import numpy as np
mlab.clf()
N = 30
x, y, z = np.random.random((3, N))
t = np.random.random((3, 3, N))
points = np.c_[x.T.ravel(), y.T.ravel(), z.T.ravel()]
tensors = np.reshape(t.T, (N, 9))
# The TVTK dataset.
mesh = tvtk.PolyData(points=points)
mesh.point_data.tensors = tensors
mesh.point_data.tensors.name = 'tensors'
tensor_glyph = mlab.pipeline.tensor_glyph(mesh)
# Nice colors
tensor_glyph.glyph.color_mode_tensor = 'eigenvalues'
tensor_glyph.glyph.glyph_source.glyph_source.theta_resolution = 12
tensor_glyph.glyph.glyph_source.glyph_source.phi_resolution = 12
mlab.show()
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users