mayavi

Embedding mayaVI within wxPython

爱⌒轻易说出口 提交于 2019-12-13 03:20:57
问题 UPDATE: I've placed print commands within the code to isolate the moment of error. The output for the below code is a b c d . I ended up switching to pyqt/pyside using the alternative code provided, but please let me know if I can help in any other way from my current setup in debugging this issue. from numpy import ogrid, sin from traits.api import HasTraits, Instance from traitsui.api import View, Item from mayavi.sources.api import ArraySource from mayavi.modules.api import IsoSurface from

How can I install mayavi on Windows for python 3 via conda?

巧了我就是萌 提交于 2019-12-12 14:17:28
问题 I have a python 3 virtual environment managed by conda on Windows. I want to install the mayavi package via conda install mayavi but it says it requires python 2.7. 回答1: Have your luck with a mayavi package available on other channels, by searching on the Anaconda website. As of today, the one maintained on the conda-forge channel is compatible with python 3.5 and 3.6. To install it, conda install -c conda-forge mayavi If mayavi fails with an ImportError: Could not import backend for traits

From mayavi import mlab error

孤者浪人 提交于 2019-12-12 02:29:18
问题 I am new to using python and have had some trouble getting the mlab module within mayavi to work. In my script I can import mayavi just fine, but when I include the line: from mayavi import mlab it produces the error : Fatal Python error: PyThreadState_Get: no current thread Abort trap: 6 I have spent a few hours trying to fix this error, but have come up empty handed. Does anyone know why this line specifically crashes? I can import other modules just fine, but the mlab one doesn't work.

PyQt4 scrollbar interacts incorrectly with embedded scenes

情到浓时终转凉″ 提交于 2019-12-11 23:09:19
问题 I'm having an issue combining PyQt4 scrollbars (on the MainWindow) with embedded scenes - everything works fine until I resize my window, after which my scenes begin to travel with the scrollbar off the page. Below is the simplified, full code to illustrate this behavior (with two screenshots attached afterward to explicitly showcase this interaction): import sys, os from pyface.qt import QtGui, QtCore os.environ['ETS_TOOLKIT'] = 'qt4' from traits.api import HasTraits,Instance,on_trait_change

How to set zoom factor in Mayavi

余生长醉 提交于 2019-12-11 20:39:40
问题 I am trying to set the zoom factor in Mayavi2, for example: from mayavi import mlab mlab.test_plot3d() mlab.show() f = mlab.gcf() cam = f.scene.camera cam.zoom(0.1) mlab.draw() but nothing happens. The zoom is the same as before; have I missed something? 回答1: It seems that you have just inverted 2 lines. mlab.show() and mlab.draw() ! Try this: from mayavi import mlab currfig = mlab.test_plot3d() mlab.draw() cam = currfig.scene.camera for ii in range(100): cam.zoom(0.99) mlab.draw() mlab.show(

Mayavi multiple scene selector

做~自己de王妃 提交于 2019-12-11 15:48:32
问题 I need to load multiple scenes with option to switch them. Something like on the image: For button "1" something like mlab.points3d(x1, y1, z1, s1, color=blue) For button "2" something like mlab.points3d(x2, y2, z2, s2, color=red) For button "3" something like mlab.points3d(x3, y3, z3, s3, color=green) How to manage drawing inside another scene? (I suppose that mlab.points3d should be done before option to switch between scenes). And how to define buttons for scheme switching? 回答1: Here is an

Plotting 3D points with different colors in Mayavi (Python)

假装没事ソ 提交于 2019-12-11 15:38:40
问题 Is there any way to give mayavi a list of tuples, or maybe some numpy array of number_of_points x 3 size, such that I can specify different colour for each point? So, I have the following data: x of size Nx1 (contains x coordinates of N points) y of size Nx1 (contains y coordinates of N points) z of size Nx1 (contains z coordinates of N points) R of size Nx1 (contains the values for the R channel of N points) G of size Nx1 (contains the values for the G channel of N points) B of size Nx1

What could I do to build the 3D Bar Chart on my machine using Mayavi?

柔情痞子 提交于 2019-12-11 15:12:20
问题 Want to build a 3D Bar Chart using Mayavi (on my Asus Laptop Intel CoreTM i7-4510U CPU @ 2.00 GHz with 8 GBs de RAM, Windows 10) using a Jupyter Notebook (on a Python virtualenv) but I'm getting a grey screen. Once the data was imported, I clicked in New > Python 3 and wrote Used pandas' fast CSV parser, pandas.read_csv(), and once I ran line 4, I could see the memory usage increase to 88% of the capable using CleanMem Mini Monitor and got results in less than 1 minute. Then, to build the bar

Change mlab quiver3d & surf data sources without clearing figure in traits script

久未见 提交于 2019-12-11 05:28:14
问题 I have a Traits and Mayavi script that presents an mlab scene and several traits editors. The editors affect what data is shown in a surface , quiver3d and legend (Scalar LUT Manager) by calling my drawing method. Each change triggers a clear figure and re-draw. Learning from the Mlab interactive dialog example the plot3d * uses mlab_source.set to change the data without clearing the figure and re-drawing. In update_plot(): if self.plot is None: self.plot = self.scene.mlab.plot3d(x, y, z, t,

Convert mayavi mlab.contour3d plot to vtkPolyData

强颜欢笑 提交于 2019-12-11 04:26:57
问题 I am trying to get the triangulated vtkPolyData from a mlab.contour3d plot. I am using mayavi because it seems to be the fastest way to get minimal surfaces triangulated properly. I need it as vtkPolyData because I want to save it as an .stl file. Here is a MWE of my code: import numpy as np from mayavi import mlab def fun(x, y, z): return np.cos(x) + np.cos(y) + np.cos(z) x, y, z = np.mgrid[-1:1:100j, -1:1:100j, -1:1:100j] contour = mlab.contour3d(x, y, z, fun) mlab.show() What I get then