Hello, I'm managing to show the info from two scalars, following the example of the electronic orbital, however I would like to change the second scalar in an interactive way.
I've read the doc about animation: http://github.enthought.com/mayavi/mayavi/mlab.html#animating-the-data but unfortunaly the only scalar I can get hold is the d, meanwhile I'm interested in second_scalar Is there a way to change it or to get hold of that scalar, without blowing the memory? Cheers, Michele.
from enthought.mayavi import mlab import numpy as np x = np.array([0.0, 25.0, 50.0, 50.0, 96.053047180175781, 142.10609436035156, 50.0, 96.053047180175781, 142.10609436035156]) y = np.array([0.0, 0.0, 0.0, 0.0, 19.470916748046875, 38.94183349609375, 0.0, -19.470916748046875, -38.94183349609375]) z = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) d = np.array([ 5., 5., 5., 1.5, 1.5, 1.5, 1.5, 1.5, 1.5]) edges = np.array([[1, 0], [2, 1], [4, 3], [5, 4], [7, 6], [8, 7]]) second_scalar = np.array([10, 10, 10, 20, 20, 20, 30, 30, 30]) points = mlab.pipeline.scalar_scatter(x, y, z, d/2.0) dataset = points.mlab_source.dataset dataset.point_data.get_array(0).name = 'diameter' dataset.lines = np.vstack(edges) dataset.point_data.update() # The tube src = mlab.pipeline.set_active_attribute(points, point_scalars='diameter') stripper = mlab.pipeline.stripper(src) tube = mlab.pipeline.tube(stripper, tube_sides = 6, tube_radius = 1) tube.filter.capping = True # tube.filter.use_default_normal = False tube.filter.vary_radius = 'vary_radius_by_absolute_scalar' # Extend to the right lenght repeat = len(d) / len(second_scalar) scalar = np.repeat(second_scalar, repeat) array_id = dataset.point_data.add_array(second_scalar) dataset.point_data.get_array(array_id).name = 'second_scalar' dataset.point_data.update() src2 = mlab.pipeline.set_active_attribute(tube, point_scalars='second_scalar') surf = mlab.pipeline.surface(src2) ms = surf.mlab_source print ms.scalars
------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________ MayaVi-users mailing list MayaVi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mayavi-users