Sushilkumar | 3 Jan 05:02 2015

Mayavi query


I am trying to use Mayavi to develop a magnetic dipole field in Cartesian coordinate system. 

However when I run the python script I get the following errors

Generic Warning: In /build/buildd/vtk-5.8.0/
Filtering/vtkPolyLine.cxx, line 199
Coincident points in polyline...can't compute normals

I am using the same python script as in the link below. The difference being the formula used for calculating the field components (Please let me know if you would like me to email you my python script). Could you suggest ways to overcome the above error?

Thanks in advance and appreciate your help


"Claiming that something can move faster than light is a good conversation-stopper in physics. People edge away from you in cocktail parties; friends never return phone calls. You just don’t mess with Albert Einstein."

Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now.
MayaVi-users mailing list
MayaVi-users <at>
Luke Zoltan Kelley | 4 Sep 04:10 2014

Misaligned streamlines overplotted on image planes

I'm trying to plot magnetic field lines (mlab.pipeline.streamline), in addition to two image planes of density (mlab.pipeline.image_plane_widget) in a cubic (512^3) grid.  In general this is working well, but occasionally the streamlines' bounding box is no longer aligned with that of the image planes; each time the streamlines' box becomes elongated along a single direction*.  The data is always in a 512^3 grid, but only some snapshots create this problem --- so it seems to be an issue with the autoscaling based on the shape of the streamlines.

Is there a way to manually set the aspect ratio of the streamlines?

Here is the script I'm using which acts on a scalar array 'scal' (512x512x512), and vector array 'vect' (512x512x512x3):

mlab.options.offscreen = True
fig    = mlab.figure(size=[1000,1000])
extent = [0,1,0,1,0,1]
shape  = np.shape(scal)
x,y,z  = np.mgrid[ 0:1.0:1j*shape[0] , 0:1.0:1j*shape[1] , 0:1.0:1j*shape[2] ]

# Draw vector field                                                                                                                                                             
u,v,w      = vect[...,0], vect[...,1], vect[...,2]
vect_field = mlab.pipeline.vector_field(x,y,z, u,v,w)
streams    = mlab.pipeline.streamline(vect_field, figure=fig, extent=extent, reset_zoom=False, seedtype='plane', seed_scale=2.0, colormap='Greens')

streams.stream_tracer.integration_direction = 'both'
seed = streams.seed.widget
seed.set( normal=[0.0,0.0,1.0] )
seed.set( center=[0.5,0.5,0.5] )
seed.set( resolution=SEED_RESOLUTION )
seed.enabled = False
# Draw scalar field
scal       = np.log10(scal)
scal_field = mlab.pipeline.scalar_field(x,y,z, scal)
midz       =[2]*0.5))
plane1 = mlab.pipeline.image_plane_widget(scal_field, figure=fig, plane_orientation='z_axes', slice_index=midz, opacity=0.1, transparent=True, extent=extent, reset_zoom=False )
plane2 = mlab.pipeline.image_plane_widget(scal_field, figure=fig, plane_orientation='x_axes', slice_index=0, opacity=0.1, extent=extent, reset_zoom=False )

mlab.view(35, 75, 3.0, focalpoint=[0.5,0.5,0.4])


Slashdot TV.  
Video for Nerds.  Stuff that matters.
MayaVi-users mailing list
MayaVi-users <at>
david | 26 May 15:48 2014

Problem of ScalarCutPlane module: how to fix the normal direction or hide the normal arrow

I am developing a program based on Mayavi and TraitsUI, which need a fixed 
normal direction ScalarCutPlane to display unstructured grid data.
Firstly, I am trying to catch  the ScalarPlanCut.implict_plane.nomral change 
event using HasTraits.on_trait_change method. However, it only catches the 
initial assignment to normal. The trait changing using mouse interaction does 
not invoke the bond method.
Then, I try to catch the changing event of 
ScalarPlanCut.implict_plane.nomral_to_x_axis. And python tell the attribute 
normal_to_x_axis can not be accessed. I looked into the source code of 
ImplicitPlane. I find that normal_to_x_aixs exsites.
So the first question is how to access "normal_to_x_axis" publicly. Another 
question is the comment in source code of ImplictPlane mentioned that there is 
"modified_event" can be caught if the state of normal is changed. but it don't 
tell explicitly what name it is. So the question is how to catch the 
Any help will be appreciated.

The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
Daniel Pflugfelder | 16 May 17:37 2014

Clipping planes in Mayavi?


I have a complex 3D scene in Mayavi. To get a better overview I would like
to clip away part of the scene. The closest thing to realise this I found
was the camera clipping range, such as:


This works, but as soon as I move the scene the clipping is gone and the
full scene is there again. 
Does Mayavi offer the possibility for persistent clipping planes, ideally in
all three directions?

Any help is greatly appreciated!

"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
GeeKer Wang | 27 Apr 10:51 2014

How to use MultilineTextEditor or SourceCodeEditor?

I want to edit ProgrammableFilter source code in the PropertyEditor,
but I can't find a multiline text editor for Str.

There are MultilineTextEditor and SourceCodeEditor in the Mayavi
source code, but I don't know if anyone have used them.

Any idea? Thanks.



Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
Prabhu Ramachandran | 17 Apr 21:41 2014

Mayavi and VTK 6.x

Hi all,

Thanks to a lot of effort from Deepak Surti, we have a working version 
of Mayavi with VTK-6.x.

There were a few upstream bugs in VTK which have been fixed. The latest 
version of VTK master should work although VTK-6.1 + the following 
patches is well tested to work:

One of these is not merged yet but should be merged soon. With these, 
all the TVTK and mayavi tests pass.  There are 2 of the integration 
tests that fail but everything else passes. All the examples have also 
been tested and seem to run fine. This is the first phase of the 
migration to the new pipeline and once this is merged, we will work on 
the next set of changes to move to the new pipeline.  Note, that VTK 
5.10.1 continues to work fine as before and will continue to do so. 
Travis-ci continues to build only with 5.x and not with 6.x.

Over the next few weeks, as time permits, we will try to make some more 
changes.  This mostly has to do with using the new pipeline better.  We 
will also refactor some of the changes to be a little cleaner.



Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
Florian M. Wagner | 16 Apr 11:57 2014

Interactive Slicer for 3D unstructured grid

Dear all,

as a quick inspection of simulation results I would like to add a Python function that takes a VTK file (3D tetrahedral grid with cell data) and opens a mayavi window with an interactive slicer. Is that technically possible and could you point me in the right direction? For the time being my code only visualizes the gridpoints:

def showMesh3D(mesh, interactive=True):
    Proof of concept for mayavi binding.

    # should avoid opening of mayavi window when building documentation
    if not interactive:
        mlab.options.offscreen = True

    fig = mlab.figure(bgcolor=(1, 1, 1), size=(400, 400))

    # temporary VTK write & read, may be replaced with direct VTK object.
    tmp = "/tmp/3d_view_%s.vtk" % os.getpid()
    src =, figure=fig)

    surf = mlab.pipeline.surface(src, figure=fig, opacity=0.5)
    edges = mlab.pipeline.extract_edges(surf, figure=fig)
    mlab.pipeline.surface(edges, color=(0, 0, 0), figure=fig)
    #mlab.pipeline.image_plane_widget(surf, colormap='gray',

Thanks a lot,
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
MayaVi-users mailing list
MayaVi-users <at>
Benjamin Hervy | 12 Mar 22:07 2014

Using UDP API and camera in Mayavi


I'm facing some issues with Mayavi (great soft BTW) and especially when handling camera through udp api.

Here is my use case:
I have a python script to display a graph. Once the graph is drawn, I use serve_udp() method to wait for commands over udp protocol.
I want to send commands like camera.zoom(), camera.roll().

For example, when I want to zoom on a particular node in the graph, I retrieve x,y,z coordinates of the node and send
sock.sendto('camera.view(focalpoint=(str(x)+','+str(y)+','+str(z)+'))', '', 9008) ) to focus on the particular 3D point in the scene.

Where view() function is defined based on the doc :

Mayavi tells me that « exceptions.AttributeError: 'OpenGLCamera' object has no attribute 'view' »

But passing the same command inside the drawing script (using from import camera) works well.
So I guessed that the two camera classes are not the same.

I've then tried to read doc related to OpenGLcamera such as here :

But passing 'camera.SetFocalPoint(x,y,z)' through udp protocol raises the same error : exceptions.AttributeError: 'OpenGLCamera' object has no attribute 'SetFocalPoint'

Only camera.zoom(), camera.roll() seem to work.
Where am I wrong ? Is there a list of available methods to be used this way ?

Many thanks in advance.

Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
MayaVi-users mailing list
MayaVi-users <at>
Indranil Sinharoy | 7 Mar 17:21 2014

How to join/connect/group multiple objects in Mayavi?


I would like to combine multiple Mayavi objects (which shows up as multiple 
data sources in the pipeline view) into a single "grouped" object so that I 
control all of their properties together. How can I do this?

A more detailed description of the question with the exact problem I am trying 
to solve (with code and pictures) is posted in stackoverflow 

Thank you very much,

Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
Thomas Vanneste | 13 Jan 09:56 2014

How to do Delaunay Triangulation with xz data instead of xy data

Hi everyone,

I am trying to plot some experimental data and I am facing a problem 
with the triangulation due to the y coordinates .. I figure out that the 
solution might be to change the grid from a xy to a xz one and use the y 
as the elevation. When I do that, the triangulation works perfects, but 
obviously the plot is rotated.

So is there a way to do so, maybe by using some masks or some filters to 
just invert the y and z columns for the triangulation?

Here is a basic code:

     import numpy
     from mayavi import mlab

     X2 = numpy.array([0, 0, 1, 1])
     Y2 = numpy.array([0.5, 0.45, 1, 0.5])
     Z2 = numpy.array([0, 1, 0.5,0])

     fig = mlab.figure(1, bgcolor=(1, 1, 1), fgcolor=(0.5, 0.5, 0.5))
     # Define the points in 3D space
     # including color code based on Z coordinate.
     pts = mlab.points3d(X2, Y2, Z2, Y2, colormap='jet')
     # Triangulate based on X, Y with Delaunay 2D algorithm.
     # Save resulting triangulation.
     mesh = mlab.pipeline.delaunay2d(pts)
     # Remove the point representation from the plot
     # Draw a surface based on the triangulation
     surf = mlab.pipeline.surface(mesh, colormap='jet')

     # Simple plot.

CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
Jason Moore | 18 Dec 23:31 2013

Dark background for wx in Ubuntu

I've installed pyqt to get better visuals, but it would be nice if this wasn't the default when you install mayavi from Ubuntu's package managers on the latest version of Ubuntu.

+01 530-601-9791
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
MayaVi-users mailing list
MayaVi-users <at>