> I don't know: you gave only a fairly non-specific description of your
> problem. I would have to write an example to find out where things
> exactly fail.
I did attach a script. The failure occurs at the second
set_active_attribute(). It does not matter what you replace my Phi with, in
fact, you can use the following:
import numpy as np
x, y, z = np.ogrid[-.5:.5:200j, -.5:.5:200j, 0:1:1j]
r = np.sqrt(x**2 + y**2 + z**2)
L = -r**3/6 + 5./2*r**2 - 10*r + 6
Y = (x+y*1j)**2*z/r**3
Phi = L*Y*np.exp(-r)*r**2
from enthought.mayavi import mlab
mlab.figure(1, fgcolor=(1, 1, 1), bgcolor=(0, 0, 0))
src = mlab.pipeline.scalar_field(np.abs(Phi))
src.image_data.point_data.add_array(np.angle(Phi).T.ravel())
src.image_data.point_data.get_array(1).name = 'angle'
src2 = mlab.pipeline.set_active_attribute(src,
point_scalars='scalar')
contour = mlab.pipeline.contour(src2)
contour2 = mlab.pipeline.set_active_attribute(contour,
point_scalars='angle')
mlab.pipeline.surface(contour2, colormap='hsv')
mlab.colorbar(title='Phase', orientation='vertical', nb_labels=3)
which is atomic_orbital.py with comments removed and the z-axis shortened to a
single point. No other changes.
> It seems convoluted to me: you are using a visualization package as a
> numerical computing tool. Not to say that VTK does not do numerical
> computing well, but you are fighting it.
True, but this is part of visualisation post-processing which is done by
mayavi anyway, so it seems a logical choice. If you have a nice interpolation
library in mind, which could do the same thing easily from a python interface
(I am willing to go to C, too), I will be more than happy to try that.
Mayavi's biggest appeal is in its extremely easy-to-use interface. The amount
of glue code needed is almost zero.
> I would try representing data as a surface (PolyData, which you can
> create using an mlab.mesh command) and applying to it a 2D contouring
> operation (I do not know out of the top of my head what the name of the
> corresponding VTK filter is, but I am pretty sure that it exists.
That approach has the disadvantage of enforcing an image window. Is there a
way of doing the mlab.mesh without the final surface? Use it to just construct
the PolyDataNormals?
Also, mesh is *very* slow, but it does work.
Cheers,
Juha
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users