def test_den(): P = np.random.random((10,10)) #P=np.load(r'c:\maxdenP.np.npy') #myfilestr=r'c:\structfactors_density.dat' #x,y,z=np.loadtxt(myfilestr).T #P=z.reshape((101,101)) #print P.shape fig=mlab.figure() x,y,z=gen_as() #view along z-axis pts_as=mlab.points3d(x,y,z-.125,color=(1,0,0),colormap='gist_rainbow',figure=fig,scale_factor=.1) x,y,z=gen_fe() print 'x',x print 'y',y print 'z',z pts_fe=mlab.points3d(x,y,z-.125,color=(0,1,0),colormap='gist_rainbow',figure=fig,scale_factor=.02) x,y,z=gen_sr() pts_sr=mlab.points3d(x,y,z-.125,color=(0,0,1),colormap='gist_rainbow',figure=fig) outline=mlab.outline(figure=fig,extent=[0,1,0,1,-1,0]) mlab.orientation_axes(figure=fig,xlabel='a',ylabel='b',zlabel='c') print 'shape',P.shape P = P[:,:, np.newaxis] print 'after',P.shape src = mlab.pipeline.scalar_field(P) #src = mlab.pipeline.array2d_source(P) surf = mlab.pipeline.surface(src,figure=fig,extent=[0,1,0,1,-1,0],name='surf2',opacity=0.4) #surf.transform.GetTransform().RotateX(90) print 'done'
def draw_struct(): fig = mlab.figure() r = gen_fe() s = gen_spins() #view along z-axis x = r[:, 0] y = r[:, 1] z = r[:, 2] u = s[:, 0] v = s[:, 1] w = s[:, 2] #print x.shape #print y.shape #print z.shape pts_as = mlab.points3d(x, y, z, color=(0, 0, 1), colormap='gist_rainbow', figure=fig, scale_factor=.1) mlab.quiver3d(x, y, z, u, v, w, line_width=3, scale_factor=.3, figure=fig) outline = mlab.outline(figure=fig, extent=[0, 1, 0, 1, 0, 1]) mlab.orientation_axes(figure=fig, xlabel='a', ylabel='b', zlabel='c') print 'done'
def test_den(): #P = np.random.random((10,10)) #P=np.load(r'c:\maxdenP.np.npy') #myfilestr=r'c:\structfactors_density.dat' #x,y,z=np.loadtxt(myfilestr).T #P=z.reshape((101,101)) #print P.shape fig = mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1)) x, y, z = np.array([[1, 0, 1], [0, -1, 1], [-1, 0, -1], [0, 1, -1], [1, 1, 0], [-1, -1, 0]], 'float64').T #view along z-axis pts_as = mlab.points3d(x, y, z, color=(1, 0, 0), colormap='gist_rainbow', figure=fig, scale_factor=.3) #x,y,z=gen_fe() print 'x', x, x.shape print 'y', y, y.shape print 'z', z, z.shape x, y, z = np.array([ [0, 1, 1], [0, -1, -1], ], 'float64').T pts_FE = mlab.points3d(x, y, z, color=(0, 1, 0), colormap='gist_rainbow', figure=fig, scale_factor=.3) mlab.text3d(0, 1, 1, '011', scale=.2, color=(1, 1, 0)) mlab.text3d(1, 1, 0, '110', scale=.2) mlab.text3d(-1, -1, 0, '-1-10', scale=.2) mlab.text3d(1, 0, 1, '101', scale=.2) mlab.text3d(0, -1, 1, '0-11', scale=.2) mlab.text3d(-1, 0, -1, '-10-1', scale=.2) mlab.text3d(0, 1, -1, '01-1', scale=.2) #pts_fe=mlab.points3d(x,y,z-.125,color=(0,1,0),colormap='gist_rainbow',figure=fig,scale_factor=.02) #x,y,z=gen_sr() #print 'x',x,x.shape #pts_sr=mlab.points3d(x,y,z-.125,color=(0,0,1),colormap='gist_rainbow',figure=fig) #outline=mlab.outline(figure=fig,extent=[0,1,0,1,-1,0]) outline = mlab.outline(figure=fig) mlab.orientation_axes(figure=fig, xlabel='a', ylabel='b', zlabel='c') #print 'shape',P.shape #P = P[:,:, np.newaxis] #print 'after',P.shape #src = mlab.pipeline.scalar_field(P) #src = mlab.pipeline.array2d_source(P) #surf = mlab.pipeline.surface(src,figure=fig,extent=[0,1,0,1,-1,0],name='surf2',opacity=0.4) #surf.transform.GetTransform().RotateX(90) print 'done'
def Show_Phase(phase_numpy): dims=phase_numpy.shape fig=mlab.figure() src = mlab.pipeline.scalar_field(phase_numpy) mlab.outline() mlab.orientation_axes() #v= mlab.pipeline.vector_field(velx_numpy,vely_numpy,velz_numpy) #vx=mlab.pipeline.scalar_field(velx_numpy) #vy=mlab.pipeline.scalar_field(vely_numpy) #vz=mlab.pipeline.scalar_field(velz_numpy) extract=mlab.pipeline.extract_grid(src) extract.set(x_min=1,x_max=dims[0]-2,y_min=1,y_max=dims[1]-2) surf = mlab.pipeline.contour_surface(extract)
def test_den(): #P = np.random.random((10,10)) #P=np.load(r'c:\maxdenP.np.npy') #myfilestr=r'c:\structfactors_density.dat' #x,y,z=np.loadtxt(myfilestr).T #P=z.reshape((101,101)) #print P.shape fig=mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1)) x,y,z=np.array([[1,0,1], [0,-1,1], [-1,0,-1], [0,1,-1], [1,1,0], [-1,-1,0] ],'float64').T #view along z-axis pts_as=mlab.points3d(x,y,z,color=(1,0,0),colormap='gist_rainbow',figure=fig,scale_factor=.3) #x,y,z=gen_fe() print 'x',x,x.shape print 'y',y,y.shape print 'z',z,z.shape x,y,z=np.array([[0,1,1], [0,-1,-1], ],'float64').T pts_FE=mlab.points3d(x,y,z,color=(0,1,0),colormap='gist_rainbow',figure=fig,scale_factor=.3) mlab.text3d(0, 1, 1,'011',scale=.2,color=(1,1,0)) mlab.text3d(1, 1, 0,'110',scale=.2) mlab.text3d(-1, -1, 0,'-1-10',scale=.2) mlab.text3d(1, 0, 1,'101',scale=.2) mlab.text3d(0, -1, 1,'0-11',scale=.2) mlab.text3d(-1, 0, -1,'-10-1',scale=.2) mlab.text3d(0, 1, -1,'01-1',scale=.2) #pts_fe=mlab.points3d(x,y,z-.125,color=(0,1,0),colormap='gist_rainbow',figure=fig,scale_factor=.02) #x,y,z=gen_sr() #print 'x',x,x.shape #pts_sr=mlab.points3d(x,y,z-.125,color=(0,0,1),colormap='gist_rainbow',figure=fig) #outline=mlab.outline(figure=fig,extent=[0,1,0,1,-1,0]) outline=mlab.outline(figure=fig) mlab.orientation_axes(figure=fig,xlabel='a',ylabel='b',zlabel='c') #print 'shape',P.shape #P = P[:,:, np.newaxis] #print 'after',P.shape #src = mlab.pipeline.scalar_field(P) #src = mlab.pipeline.array2d_source(P) #surf = mlab.pipeline.surface(src,figure=fig,extent=[0,1,0,1,-1,0],name='surf2',opacity=0.4) #surf.transform.GetTransform().RotateX(90) print 'done'
def test_quiver3d(): fig=mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1)) x, y, z = numpy.mgrid[-2:3, -2:3, -2:3] print 'almost' #mlab.quiver3d(x, y, z,f, line_width=3, scale_factor=1,figure=fig) d=0.2 x=d*numpy.arange(0,25) y=-d*numpy.arange(0,25) z=numpy.zeros(len(x)) if 0: func=spiral if 1: func=amplitude mlab.quiver3d(x, y, z,func, line_width=3, scale_factor=1,figure=fig) outline=mlab.outline(figure=fig,extent=[-1,1,-1,1,-1,1]) mlab.orientation_axes(figure=fig,xlabel='a',ylabel='b',zlabel='c') print 'done'
def test_quiver3d(): fig = mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1)) x, y, z = numpy.mgrid[-2:3, -2:3, -2:3] print 'almost' #mlab.quiver3d(x, y, z,f, line_width=3, scale_factor=1,figure=fig) d = 0.2 x = d * numpy.arange(0, 25) y = -d * numpy.arange(0, 25) z = numpy.zeros(len(x)) if 0: func = spiral if 1: func = amplitude mlab.quiver3d(x, y, z, func, line_width=3, scale_factor=1, figure=fig) outline = mlab.outline(figure=fig, extent=[-1, 1, -1, 1, -1, 1]) mlab.orientation_axes(figure=fig, xlabel='a', ylabel='b', zlabel='c') print 'done'
def draw_struct(): fig=mlab.figure() r=gen_fe() s=gen_spins() #view along z-axis x=r[:,0] y=r[:,1] z=r[:,2] u=s[:,0] v=s[:,1] w=s[:,2] #print x.shape #print y.shape #print z.shape pts_as=mlab.points3d(x,y,z,color=(0,0,1),colormap='gist_rainbow',figure=fig,scale_factor=.1) mlab.quiver3d(x, y, z,u,v,w, line_width=3, scale_factor=.3,figure=fig) outline=mlab.outline(figure=fig,extent=[0,1,0,1,0,1]) mlab.orientation_axes(figure=fig,xlabel='a',ylabel='b',zlabel='c') print 'done'
def Show_Phase(phase_numpy): dims = phase_numpy.shape fig = mlab.figure() src = mlab.pipeline.scalar_field(phase_numpy) mlab.outline() mlab.orientation_axes() #v= mlab.pipeline.vector_field(velx_numpy,vely_numpy,velz_numpy) #vx=mlab.pipeline.scalar_field(velx_numpy) #vy=mlab.pipeline.scalar_field(vely_numpy) #vz=mlab.pipeline.scalar_field(velz_numpy) extract = mlab.pipeline.extract_grid(src) extract.set(x_min=1, x_max=dims[0] - 2, y_min=1, y_max=dims[1] - 2) surf = mlab.pipeline.contour_surface(extract) #mlab.pipeline.image_plane_widget(vx, plane_orientation='x_axes', slice_index=250) #mlab.pipeline.vectors(v, mask_points=20, scale_factor=3.) #mlab.pipeline.vector_cut_plane(v, mask_points=2, scale_factor=3) mlab.show()
# -*- coding: utf-8 -*- from enthought.mayavi import mlab from tvtk_rectilineargrid import r from figure_imagedata import plot_cell if __name__ == "__main__": mlab.figure(1, fgcolor=(0, 0, 0), bgcolor=(1, 1, 1)) mlab.clf() mlab.pipeline.surface(mlab.pipeline.extract_edges(r), color=(0, 0, 0)) mlab.pipeline.glyph(r, mode='sphere', scale_factor=0.5, scale_mode='none') plot_cell(r.get_cell(1)) mlab.text(0.01, 0.9, "get_cell(1)", width=0.25) axes = mlab.orientation_axes() mlab.show()
def plot3d(cf, vp1, vp2, precision, m1,m2,centerline,showbases,seq,mult,ghost): #DRAWS THE MOLECULE(S) print "Loading mlab....." from anim import stiffness, ACP from draw import data3d from enthought.mayavi import mlab r, q, d, g, h, sequence = cf nbbases = q.shape[0] #mlab.options.backend = 'envisage' #to use the full Mayavi interface fig = mlab.figure(1, bgcolor=(0, 0, 0), size=(1024,768)) #creates a new window mlab.clf() #clears the window if centerline >0 : #DRAWS CENTRAL AXIS #axis_nodes = mlab.points3d(q[:,0],q[:,1],q[:,2],scale_factor=0.4,color=(1,0,1)) ghost_axis = mlab.plot3d(q[:,0],q[:,1],q[:,2],tube_radius=0.05, color=(1,1,1)) #will never move axis = mlab.plot3d(q[:,0],q[:,1],q[:,2],tube_radius=0.05, color=(1,0,1)) #DRAWS LAB FRAME e ee = mlab.quiver3d([0,0,0],[0,0,0],[0,0,0],[1,0,0],[0,1,0],[0,0,1], \ mode='arrow',scale_factor=2, color=(1,1,1)) if showbases >0 : #DRAWS BASES AND BASE FRAMES points, triangles, centres, frames, i,j, repere, s = data3d(r,d,sequence) #see draw.py if ghost >0 : ghost = mlab.triangular_mesh(points[:,0],points[:,1],points[:,2],triangles,color=(1,1,1),opacity=0.4) k = array(repere)[nbbases,0] #index i : points l = array(repere)[nbbases,1] #index j : triangles main_strand = mlab.triangular_mesh(points[:k,0],points[:k,1],points[:k,2],triangles[:l],\ scalars=s[:k], colormap="autumn") #main strand comp_strand = mlab.triangular_mesh(points[k:i,0],points[k:i,1],points[k:i,2],triangles[l:j]-triangles[l,0],\ scalars=s[k:i], colormap="autumn") #complementary baseframes = mlab.quiver3d(centres[:,0],centres[:,1],centres[:,2],frames[:,0],frames[:,1],frames[:,2], \ mode='arrow',scale_factor=2, colormap="Oranges") #ANIMATION if vp1 >0 : if centerline >0 : #axis_nodes_src = axis_nodes.mlab_source axis_src = axis.mlab_source if showbases >0 : main_strand_src = main_strand.mlab_source comp_strand_src = comp_strand.mlab_source baseframes_src = baseframes.mlab_source vecp = stiffness(m1,1,vp1-1) #chosen eigenvector 1 #mult = 2.0 #multiple of the added eigenvector fig.scene.anti_aliasing_frames = 0 #antialiasing, default=8, off=0 for p in range(precision): wmod = ACP(readParameters(),vecp,mult*(p+1)/precision) #modified configuration cfmod = calculPoints(wmod) #modified coordinates r_p, q_p, d_p, g_p, h_p, sequence = cfmod fig.scene.disable_render = True #accelerates rendering if showbases >0 : points_p, triangles_p, centres_p, frames_p, i,j, repere, s = data3d(r_p,d_p,sequence) #modified graphics main_strand_src.set(x=points_p[:k,0],y=points_p[:k,1],z=points_p[:k,2]) comp_strand_src.set(x=points_p[k:i,0],y=points_p[k:i,1],z=points_p[k:i,2]) baseframes_src.reset(x=centres_p[:,0],y=centres_p[:,1],z=centres_p[:,2],\ u=frames_p[:,0],v=frames_p[:,1],w=frames_p[:,2]) if centerline >0 : #axis_nodes_src.set(x=q_p[:,0],y=q_p[:,1],z=q_p[:,2],scale_factor=0.7,color=(1,0,1)) axis_src.set(x=q_p[:,0],y=q_p[:,1],z=q_p[:,2],tube_radius=0.05, color=(1,0,1)) fig.scene.disable_render = False if vp2 > 0: if showbases >0 : #new instance of the entire molecule new_main_strand = mlab.triangular_mesh(points[:k,0],points[:k,1],points[:k,2],triangles[:l],\ scalars=s[:k], colormap="winter") #main strand new_comp_strand = mlab.triangular_mesh(points[k:i,0],points[k:i,1],points[k:i,2],triangles[l:j]-triangles[l,0],\ scalars=s[k:i], colormap="winter") #complementary new_baseframes = mlab.quiver3d(centres[:,0],centres[:,1],centres[:,2],frames[:,0],frames[:,1],frames[:,2], \ mode='arrow',scale_factor=2, colormap="Blues") new_main_strand_src = new_main_strand.mlab_source new_comp_strand_src = new_comp_strand.mlab_source new_baseframes_src = new_baseframes.mlab_source if centerline >0 : new_axis = mlab.plot3d(q[:,0],q[:,1],q[:,2],tube_radius=0.05, color=(1,0,1)) new_axis_src = new_axis.mlab_source vecp = stiffness(m2,1,vp2-1) #chosen eigenvector 2 #mult = 2.0 #multiple of the added eigenvector for p in range(precision): wmod = ACP(readParameters(),vecp,mult*(p+1)/precision) #modified configuration cfmod = calculPoints(wmod) #modified coordinates r_p, q_p, d_p, g_p, h_p, sequence = cfmod if showbases >0 : points_p, triangles_p, centres_p, frames_p, i,j, repere, s = data3d(r_p,d_p,sequence) #modified graphics fig.scene.disable_render = True #accelerates rendering new_main_strand_src.set(x=points_p[:k,0],y=points_p[:k,1],z=points_p[:k,2]) new_comp_strand_src.set(x=points_p[k:i,0],y=points_p[k:i,1],z=points_p[k:i,2]) new_baseframes_src.reset(x=centres_p[:,0],y=centres_p[:,1],z=centres_p[:,2],\ u=frames_p[:,0],v=frames_p[:,1],w=frames_p[:,2]) if centerline >0 : #new_axis_nodes_src.set(x=q_p[:,0],y=q_p[:,1],z=q_p[:,2],scale_factor=0.7,color=(1,0,1)) new_axis_src.set(x=q_p[:,0],y=q_p[:,1],z=q_p[:,2],tube_radius=0.05, color=(1,0,1)) fig.scene.disable_render = False mlab.orientation_axes() mlab.show()
w = np.zeros_like(z) obj = quiver3d(x, y, z, u, v, w, line_width=3, scale_factor=0.3) # outline() return obj def biot_savart(source): x, y, z = numpy.mgrid[-2:3, -2:3, -2:3] # dr = obj = plot3d(x, y, z, color=(0.1, 0.1, 1))#, tube_radius=0.1, opacity=0.5) return obj def line(pt1, pt2, tmin, tmax, numpts=30): t = linspace(tmin, tmax, numpts) x = pt1[0] + (pt2[0] - pt1[0]) * t y = pt1[1] + (pt2[1] - pt1[1]) * t z = pt1[2] + (pt2[2] - pt1[2]) * t obj = plot3d(x, y, z, color=(0.1, 0.1, 1)) return (x, y, z) if __name__ == '__main__': ## bfield() pt1 = array([-1, 0, 1], dtype=float) pt2 = array([2, 0, 1], dtype=float) linecharge = line(pt1, pt2, 0, 1) biot_savart(linecharge) # axes() # title('Free Electron Gas On a Ring') orientation_axes() # savefig('temp.eps') show()
right_ys = [] for line in data: cm = line.split() top_xs.append(float(cm[0])) left_zs.append(float(cm[2])) right_ys.append(float(cm[1])) dms.append(float(cm[9])) # diameters mlab.options.offscreen = True mlab.figure(1, bgcolor=(1, 1, 1), size=(1280, 720)) dms = [x / 2.0 for x in dms] q = mlab.quiver3d(top_xs, right_ys, left_zs, dms, dms, dms, mode='sphere', scale_factor=1) mlab.orientation_axes() mlab.outline(color=(0,0,0), line_width=1.0) a = mlab.axes(color=(0.1,0.1,0.1), nb_labels=3, line_width=1.0) a.axes.axis_label_text_property.color = (0,0,0) q.scene.isometric_view() count = 1 while count < 360: q.scene.camera.azimuth(1) mlab.draw() mlab.savefig('animate/' + stage + '-dms-animated-' + str(count).zfill(3) + '.png') count += 1 print(count)
def RunMayavi(directory): figure = mlab.figure(bgcolor=(.5, .5, .5)) #figure.scene.disable_render = True #figure.scene.magnification = 5 #figure.scene.off_screen_rendering = True ## Try to load the structure as wireframe if os.path.exists(os.path.join(directory, 'structure.vtk')): data_source = mlab.pipeline.open( os.path.join(directory, 'structure.vtk')) iso_surface = mlab.pipeline.iso_surface(data_source, color=(.8, .8, .8), contours=2, opacity=.3) iso_surface.actor.property.representation = 'wireframe' #iso_surface.actor.property.representation = 'surface' iso_surface.actor.property.line_width = .5 #iso_surface.contour.minimum_contour = 2. iso_surface.name = 'Permittivity 3-D contours' surface = mlab.pipeline.surface(data_source, opacity=.3, colormap='Greys', vmin=1.0, vmax=10.) ## For black outline in 2-D view #surface.actor.property.specular_color = (0.0, 0.0, 0.0) #surface.actor.property.diffuse_color = (0.0, 0.0, 0.0) #surface.actor.property.ambient_color = (0.0, 0.0, 0.0) #surface.actor.property.color = (0.0, 0.0, 0.0) #surface.actor.property.representation = 'wireframe' surface.name = 'Permittivity surface' surface.visible = False mlab.orientation_axes(opacity=.5) mlab.title(os.path.basename(directory), size=.2, height=.01) ## Process each file filenames = [ n for n in os.listdir(directory) if (n[-4:] == '.vtk' and not ('structure' in n) and (not 'slice' in n)) ] filenames.sort() for (count, filename) in enumerate(filenames): ## Load the files data_source = mlab.pipeline.open(os.path.join(directory, filename)) ## Plot electric field as the x-component scalar value (blue-white-red) if 'Evec' in filename: evs = mlab.pipeline.extract_vector_components(data_source) cutplane = mlab.pipeline.scalar_cut_plane( evs, plane_orientation='x_axes', colormap='RdBu') symmetric_colors(evs.children[0].scalar_lut_manager) cutplane.actor.mapper.interpolate_scalars_before_mapping = True cutplane.implicit_plane.widget.enabled = False cutplane.name = "Electric field x-component" ## Warp scalar cutplane.enable_warp_scalar = True cutplane.warp_scalar.filter.normal = np.array([1., 0., 0.]) cutplane.warp_scalar.filter.scale_factor = 100.0 ## Plot magnetic field as black vectors if 'Hvec' in filename: #cutplane = mlab.pipeline.vector_cut_plane(data_source, #plane_orientation='x_axes', mask_points=1, scale_factor=2, mode="cone", color=(0,0,0)) cutplane = mlab.pipeline.vector_cut_plane( data_source, plane_orientation='x_axes', mask_points=1, scale_factor=2, mode="cone") cutplane.name = "Magnetic field" cutplane.implicit_plane.widget.enabled = False if count > 1: cutplane.visible = False ## hide all snapshots except the first ## Set up the camera figure.scene.camera.clipping_range = [1, 1000] figure.scene.camera.focal_point = [10, 10, 30] # Y-Z view figure.scene.camera.position = [140, 10, 27] figure.scene.camera.focal_point = [10, 10, 27] figure.scene.camera.view_up = [0, -1, 0] # X-Z view #figure.scene.camera.position = [10, 140, 27] #figure.scene.camera.view_up = [1, 0, 0] #figure.scene.camera.compute_view_plane_normal() figure.scene.parallel_projection = True figure.scene.disable_render = False figure.scene.render() figure.scene.save(u'/home/filip/snapshot4.png') mlab.show()
def test_den(): P = np.random.random((10,10)) #P=np.load(r'c:\maxdenP.np.npy') #myfilestr=r'c:\structfactors_density.dat' #x,y,z=np.loadtxt(myfilestr).T #P=z.reshape((101,101)) #print P.shape fig=mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1)) x,y,z=gen_as() #view along z-axis #pts_as=mlab.points3d(x,y,z-.125,color=(1,0,0),colormap='gist_rainbow',figure=fig,scale_factor=.1) x,y,z=gen_fe() print 'x',x print 'y',y print 'z',z #pts_fe=mlab.points3d(x,y,z-.125,color=(0,1,0),colormap='gist_rainbow',figure=fig,scale_factor=.02) x,y,z=gen_sr() #pts_sr=mlab.points3d(x,y,z-.125,color=(0,0,1),colormap='gist_rainbow',figure=fig) if 1: #112 vec=np.array([1,1,-2],'Float64') genvec(vec,fig,color=(1,0,0)) vec=np.array([-2,1,1],'Float64') genvec(vec,fig,color=(1,0,0)) vec=np.array([1,-2,1],'Float64') genvec(vec,fig,color=(1,0,0)) #111 vec=np.array([1,1,1],'Float64') genvec(vec,fig, color=(0,0,1)) if 0: #111 vec=np.array([1,1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([1,1,-1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([1,-1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([-1,1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([1,-1,-1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([-1,1,-1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([-1,-1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([-1,-1,-1],'Float64') genvec(vec,fig, color=(0,0,1)) if 0: #scattering plane: vec=np.array([1,1,0],'Float64') genvec(vec,fig, color=(0,1,0)) vec=np.array([1,1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([1,1,-2],'Float64') genvec(vec,fig,color=(1,0,0)) vec=np.array([0,0,1],'Float64') genvec(vec,fig,color=(0,0,0)) if 0: #110 scattering plane: vec=np.array([1,1,0],'Float64') genvec(vec,fig, color=(0,1,0)) vec=np.array([1,1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([1,1,-2],'Float64') genvec(vec,fig,color=(1,0,0)) vec=np.array([0,0,1],'Float64') genvec(vec,fig,color=(0,0,0)) if 1: #110 scattering plane variations normal to 111 vec=np.array([1,-1,0],'Float64') genvec(vec,fig, color=(0,1,0)) vec=np.array([1,1,1],'Float64') genvec(vec,fig, color=(0,0,1)) vec=np.array([0,1,-1],'Float64') genvec(vec,fig,color=(0,1,0)) vec=np.array([-1,0,1],'Float64') genvec(vec,fig,color=(0,1,0)) if 0: #1 1 0 vec=np.array([1,1,0],'Float64') genvec(vec,fig, color=(0,1,0)) vec=-np.array([1,1,0],'Float64') genvec(vec,fig, color=(0,1,0)) vec=np.array([1,0,1],'Float64') genvec(vec,fig, color=(0,1,0)) vec=-np.array([1,0,1],'Float64') genvec(vec,fig, color=(0,1,0)) vec=np.array([0,1,-1],'Float64') genvec(vec,fig, color=(0,1,0)) vec=-np.array([0,1,-1],'Float64') genvec(vec,fig, color=(0,1,0)) #outline=mlab.outline(figure=fig) outline=mlab.outline(figure=fig,extent=[-1,1,-1,1,-1,1]) mlab.orientation_axes(figure=fig,xlabel='a',ylabel='b',zlabel='c') #print 'shape',P.shape #P = P[:,:, np.newaxis] #print 'after',P.shape #src = mlab.pipeline.scalar_field(P) #src = mlab.pipeline.array2d_source(P) #surf = mlab.pipeline.surface(src,figure=fig,extent=[0,1,0,1,-1,0],name='surf2',opacity=0.4) #surf.transform.GetTransform().RotateX(90) print 'done' if 0: mlab.view(45, 45,focalpoint=(2,2,2))