def draw(): m,g = read(sys.argv[1]) init_mlab_scene((1024,768)) print "Drawing Nickel" mlab.points3d(m.x, m.y, m.z, m.t, mode="point", scale_mode="none",scale_factor=m.d, colormap="black-white") print "Drawing Nitrogenium" mlab.points3d(g.x, g.y, g.z, g.t, mode="point", scale_mode="none",scale_factor=g.d, colormap="cool") mlab.outline()
def do_mlab(): figure = init_mlab_scene((1920,1080)) figure.scene.anti_aliasing_frames = 0 (metal, gas) = readfile_metgas_bin(sys.argv[2],[50,70,50,70, 5,12]) scatter_g = mlab.pipeline.scalar_scatter(gas.x,gas.y,gas.z,gas.v) scatter_m = mlab.pipeline.scalar_scatter(metal.x,metal.y,metal.z,metal.v) metp = mlab.points3d(metal.x,metal.y,metal.z,scale_mode="none",scale_factor=metal.d,colormap="black-white" ,color=(1,1,1),resolution=6) gasp = mlab.points3d(gas.x,gas.y,gas.z,scale_mode="none",scale_factor=gas.d,colormap="cool",color=(0.5,0.5,1),resolution=6) print "gauss" gsm = mlab.pipeline.gaussian_splatter(scatter_m) gsg = mlab.pipeline.gaussian_splatter(scatter_g) print "surf" mlab.pipeline.iso_surface(gsm,contours=5,opacity=0.5,colormap="copper",transparent=True) mlab.pipeline.iso_surface(gsg,contours=5,opacity=0.5,colormap="cool",transparent=True)
import threading from multiprocessing.dummy import Pool as ThreadPool def load_parts(fname): f = open(fname) nth = [] for line in f.readlines(): nth.append(int(float(line[:-1]))) return numpy.array(nth) file_c = len(sys.argv) frame_count = 50.0 fc = 0 init_mlab_scene((800,600)) def saved(str): return "Saved "+str def simg(fc): mlab.view(45.0, 54.735610317245346, 15.002953389457407, [ 37.98949814, 37.52174377, 13.84111261]) mlab.savefig("./advid/close_{num:09d}.png".format(num=fc)) print saved("./advid/close_{num:09d}.png".format(num=fc)) mlab.view(0, 85.735610317245346, 15.002953389457407, [ 37.98949814, 37.52174377, 13.84111261]) mlab.savefig("./advid/close_proj_{num:09d}.png".format(num=fc)) print saved("./advid/close_proj_{num:09d}.png".format(num=fc)) mlab.view(45.0, 54.735610317245346, 23.002953389457407, [ 37.98949814, 37.52174377, 13.84111261]) mlab.savefig("./advid/far_{num:09d}.png".format(num=fc))
# coding: utf-8 import sys sys.path.append("D:\\projects\\visual\\") from mmdlab.datareader import readfile_metgas_boxes from mmdlab.utils import init_mlab_scene import glob from mayavi import mlab from tvtk.api import tvtk init_mlab_scene((200,768)) fc = 1500 rot_per_frame = 20 files = glob.glob(sys.argv[1]) file_c = len(files) def saved(str): return "Saved "+str for f in files: (metal, gas) = readfile_metgas_boxes(f) gas.z = gas.z - 2.11884 gscatt = mlab.pipeline.scalar_scatter(gas.x, gas.y, gas.z, gas.t) print "Temp gauss" mlab.title('Time [0{num:09d}]' .format(num=(750000+int(f[-13:-3])))).y_position=1 #mlab.title('Time [0{num:09d}]' .format(num=(int(f[-13:-3])))).y_position=1