Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 过焊时,mayavi未对齐流线和图像平面_Python_Graphics_Mayavi - Fatal编程技术网

Python 过焊时,mayavi未对齐流线和图像平面

Python 过焊时,mayavi未对齐流线和图像平面,python,graphics,mayavi,Python,Graphics,Mayavi,我有3D标量和矢量数据,我正在与流线(mlab.pipeline.streamline)和图像平面(mlab.pipeline.image\u plane\u widget)一起绘制。这通常是可行的,但偶尔(即在某些数据集上)两种类型的图形会出现不对齐,即使数据形状完全相同 好例子: 坏例子: 这始终是一个范例:流线的边界框沿一个轴延伸。。。没有设置正在更改 例如,我有一个标量字段scal,其维度与向量字段vect相同: mlab.options.offscreen = True # In

我有3D标量和矢量数据,我正在与流线(
mlab.pipeline.streamline
)和图像平面(
mlab.pipeline.image\u plane\u widget
)一起绘制。这通常是可行的,但偶尔(即在某些数据集上)两种类型的图形会出现不对齐,即使数据形状完全相同

好例子

坏例子

这始终是一个范例:流线的边界框沿一个轴延伸。。。没有设置正在更改

例如,我有一个标量字段
scal
,其维度与向量字段
vect
相同:

mlab.options.offscreen = True

# Initialized figure                                                                                                                                                             
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'
mlab.outline()
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       = np.int(np.floor(shape[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.text3d(0.5,0.5,1.07, 'Time = %04.0f' % time, scale=0.05, figure=fig)
mlab.colorbar()
mlab.view(35, 75, 3.0, focalpoint=[0.5,0.5,0.4])

可在此处找到包含重现问题的数据的代码:

问题在于
图像平面小部件
根本不接受“范围”参数。从
image\u plane\u widget
streamline
中删除“extent”参数可以使对象匹配。

你能给出一个完整的工作示例吗?@SAAD我刚刚发布了数据和代码来重现错误