在mayavi的传染媒介裁减飞机不运作

时间:2016-06-30 11:39:21

标签: python scientific-computing mayavi

我刚尝试测试mayavivector_cut_plane功能:

import numpy as np
from mayavi import mlab

x, y, z = np.mgrid[0:1:20j, 0:1:20j, 0:1:20j]

u =    np.sin(np.pi*x) * np.cos(np.pi*z)
v = -2*np.sin(np.pi*y) * np.cos(2*np.pi*z)
w = np.cos(np.pi*x)*np.sin(np.pi*z) + np.cos(np.pi*y)*np.sin(2*np.pi*z)

src = mlab.pipeline.vector_field(u, v, w)
mlab.pipeline.vector_cut_plane(src, mask_points=2, scale_factor=3)

mlab.show()

然而它似乎不起作用,因为矢量场切割不遵循红框:

enter image description here

以下是相关的截屏视频:http://dropcanvas.com/tqaxc

知道我错了吗?

1 个答案:

答案 0 :(得分:0)

我在linux ubuntu 16.04上遇到了与Mayavi2 4.4.3相同的问题:

我在这里找到了解决方案: https://github.com/enthought/mayavi/issues/164

编辑文件(以root用户身份): /usr/lib/python2.7/dist-packages/mayavi/components/cutter.py

并在文件末尾添加以下两行:

SELECT *
FROM yourtable t1
WHERE EXISTS(
    SELECT 'STARTING'
    FROM yourtable t2
    WHERE t2.name = t1.name
    AND t2.action = 'START_PLAY'
    AND t2.timestamp >= '2017-02-02 10:30:00')
AND EXISTS (
    SELECT 'ENDING'
    FROM yourtable t3
    WHERE t3.name = t1.name
    AND t3.action = 'START_PLAY'
    AND t3.timestamp <= '2017-02-02 10:00:00')

如果您不熟悉python,请注意缩进:3个空格。先例之后的一个空的&#34; def&#34;线。

如果有帮助,请告诉我。

此致

Yves Delhaye