我刚尝试测试mayavi的vector_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()
然而它似乎不起作用,因为矢量场切割不遵循红框:
以下是相关的截屏视频:http://dropcanvas.com/tqaxc
知道我错了吗?
答案 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