Question

I have scalar values that are located on a grid of points in polar coordinates. While I can choose the theta and phi angles freely, the r values are given by another step in my data evaluation. How can I plot an isosurface and some cuts through the data using mayavi?

In the very moment, I'm trying to use scipy.interpolate.griddata to get a eucledian grid but it is working for some hours already without a result...

from scipy import *
from enthought.mayavi import mlab

r_val = [0.5, 1.0, 1.5, 2.0] # externally given
r, theta, phi = mgrid[ \
        r_val[0]:r_val[-1]:len(r_val)*1.j, \
        0:pi:len(r_val)*1.j, \
        0:2.*pi:len(r_val)*1.j ]
x = r*sin(theta)*cos(phi)
y = r*sin(theta)*sin(phi)
z = r*cos(theta)
# here would be the data
s = ones_like(x)
s *= r*r
# the x,y,z axes of this plot are r,theta,phi
mlab.contour3d(s)
# but I want them to be x,y,z!
# this does not work
#mlab.contour3d(x,y,z,s)
Was it helpful?

Solution

See http://permalink.gmane.org/gmane.comp.python.enthought.devel/20667

src = mlab.pipeline.scalar_scatter(x,y,z,s)
iso=mlab.pipeline.iso_surface(gs)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top