问题标签 [mayavi]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
518 浏览

python - tvtk 中关于 SetViewPlaneNormal 的 AttributeError

注意:已找到临时解决方案:打开camera.py、使用pass并注释函数中的内容,_view_plane_normal_changed然后重新编译。

我正在使用python(x,y)2.7.5.1. 当我使用一些使用 tvtk 的软件包(如 mayavi)时,它会引发一个AttributeError:SetViewPlaneNormal. 我知道这是因为 vtk 已弃用此方法。有谁知道如何解决它?的版本vtk5.10.1-3. 完整的引用包含一些这样的块:

0 投票
1 回答
347 浏览

python - How can I programmatically find valid names for Mayavi colormaps?

I have an application built on Mayavi where I let the user specify a colormap for some data. Because newer versions of Matplotlib have colormaps that Mayavi lacks, I'd like to be able to either use the native Mayavi colormap or make a lookuptable based on the Matplotlib colormap, if Mayavi doesn't offer it.

I could try and use the user-supplied name and catch the TraitError that is raised, but I'd rather just check the supplied name against an existing list of colors. For example, in Matplotlib I would do

Is there a similar repository of colormap names in Mayavi that I could access?

0 投票
1 回答
4052 浏览

python - Using python and mayavi to create a 3D streamplot

It is currently quite easy to produce a 2D streamplot with python and matplotlib because streamplot was recently incorporated to matplotlib by Tom Flannaghan and Tony Yu.

Although it is possible to produce certain types of 3D plots with matplotlib, 3D streamplots are not currently supported. However, the python plotting program mayavi (which provides a python interface to vtk-based plotting) is capable of 3D streamplots using its flow() function.

I've created a simple python module to streamplot data in 2D and 3D, with no Z-slope (all dZ = 0) in the 3D data set, to demonstrate the plotting challenge I'm facing with mayavi versus matplotlib on effectively matching data in the xy plane. The commented code and resulting plots are shown below:

2D matplotlib result (note the streamlines of slope 1 match sensibly with the dx and dy arrays all filled with values of unity): 2D matplotlib streamplot 3D mayavi result (attempt 1; note that the slope of the single streamline present here is correct, but the length and number of streamlines is obviously quite different from the 2D matplotlib example): enter image description here 3D mayavi result (attempt 2; note that my use of a line seed with a sufficiently high resolution has produced many more streamlines of appropriate slope, but also note that the start & end x coordinates of the black seed line specified in the code don't match with the plot) enter image description here Finally, attempt #3 (confusingly) produces the exact same plot as #2 despite the specification of different seed / widget points. So, the question is: how can I get greater control over the position of my seed line to make it diagonal? More broadly, I'd like to be able to feed in an arbitrary array of seed points for more general stream plot 3D (non-planar) problems, but solving the former specific case with the line should get me started.

Some other helpful resources I found while working on this problem, which did not quite solve my issues:

  1. matplotlib streamplot co-author Tom Flannaghan's blog post on the topic
  2. An example where a custom array of seeds is used with a subclass of mayavi Streamline (which, in turn, is used by flow()), but unfortunately with insufficient implementation detail to reproduce.
  3. Examples, including commented source code, for using mayavi to produce 2D streamplots of magnetic field lines.
  4. Similar examples with source in 3D, but still not sufficient to solve my plotting issues:
  5. The flow() plot resulting from the example code provided in the mayavi standard documentation (with spherical seed widget visible behind the streamlines).
0 投票
0 回答
1967 浏览

python - python,ImportError:没有名为 mayavi.modules.scalar_cut_plane 的模块

当我尝试在使用 mayavi 的程序上可视化某些内容时,出现以下错误:

控制台输出:

这里的文件“/home/meniwis/syscave/src/python/syscave/gui/flowsim3d.py:

我在用:

关于可能导致错误的任何线索?

预先感谢。问候。

0 投票
1 回答
304 浏览

python - Python 2.7:使用六个输入数组的 Mayavi Flow 函数

我正在尝试使用 Mayavi 的流函数准确地可视化一些 CFD 数据。我有六个 100x100x100 阵列(X、Y、Z、U、V、W),与被分析粒子的位置和速度有关。这些是使用 numpy.meshgrid 从单列数组创建的。

当我输入三个数组(例如 U、V 和 W)时,绘图效果很好,但在这种情况下,可视化缺少其余数据。在此处输入图像描述

当我输入所有六个数组时,3D 图显示为一条直线。

在此处输入图像描述

我的问题是:如何输入所有六个数组并获得工作流图?更具体地说,有人可以解释以下内容,摘自Flow 文档吗?

“假设箭头的位置是 (u, v, w) 数组中对应点的索引。”

0 投票
1 回答
1624 浏览

python - Enthought Canopy Mayavi 字体大小错误

Enthough Canopy Mayavi mlab 中的字体大小设置似乎已损坏。

既不是命令:

mlab.axes.label_text_property.font_size = 12 (e.g.)

直接菜单字体大小命令(高级设置)也不起作用。

我已经用 Enthought 记录了一个错误报告,但它看起来更像是一个更一般的 Mayavi 错误,请参阅

Mayavi“字体大小”文本属性是否有效?

0 投票
0 回答
349 浏览

plot - 在 mayavi 中绘制 paraview 数据格式文件

我正在使用带有 python 接口的 FEniCS 以数字方式求解 PDE。我正在使用 ipython 笔记本在 python 中编码,我想使用 mayavi 绘制结果。我不想使用 paraview 来绘制它。我用来将结果保存在文件中的代码是

0 投票
3 回答
7646 浏览

python - 如何在 Python 中可视化 3D delaunay 三角剖分?

我有一组 3D 点,我使用 scipy.spatial.Delaunay 进行三角剖分/四面体化。我现在有一组所有四面体的独特面,并希望在 3D 中可视化这些面。

是否有任何 Python 库(或带有 Python 包装器的库)可以做到这一点?

0 投票
1 回答
504 浏览

python - 为什么没有设置 MlabSceneModel 的 light_manager?

我正在使用 Mayavi 进行带有 TraitsUI 的 3D 可视化。这scene是 MlabSceneModel 类型的特征。我想更改照明并尝试访问事件scene.light_manager调用的函数。activated然而,scene.light_manager总是None

mlab.figure()用于创建具有灯光管理器的场景,但由于我希望将场景集成到 UI 而不是附加窗口中,所以这对我来说是没有选择的。

0 投票
1 回答
1797 浏览

python - 使用 Python 和具有多个矢量场的 tvtk 将数据保存到 VTK

我正在尝试保存与同一结构化网格相对应的三组向量(速度、湍流强度和速度波动的标准偏差)。理想情况下,我希望它们成为同一个 vtk 文件的一部分,但到目前为止,我只能将其中一个放入文件中,如下所示:

我花了几个小时寻找一个如何添加一个以上向量或标量字段的示例,但失败了,所以我想在这里问。任何指导将不胜感激。

谢谢,

阿图尔