Exemple #1
0
def do_mlab():

	f = open(sys.argv[1]+"/index.list","r")
	lines = f.readlines()


	calls = []
	lc = None
	for i,line in enumerate(lines):
		calls.append( (i, sys.argv[1]+line[:-1])) #,region=[0,10000,0,30,8,13])
		lc = sys.argv[1]+line[:-1]		
	print calls

	ppservers = ()
	job_server = pp.Server(ppservers=ppservers, ncpus = 10)

	print "Starting pp with", job_server.get_ncpus(), "workers"
	# The following submits 8 jobs and then retrieves the results
	jobs = [ job_server.submit(readdata,(data[1],), (mfilter,), ("mmdlab","mmdlab.datareader")) for data in calls];

	size = int(1920), int(1080)
	fig = mlab.figure('Viz', size=size,bgcolor=(0,0,0))
	fig.scene.anti_aliasing_frames = 0

	import time
	gas  = []
	for i,job in enumerate(jobs):
		(metal,g)  =  job()
		gas.append(g)
		print "Job",i,"done"

	traj = get_traj(gas)

	parts_no = [8144152,8156221, 8131715, 8146196, 8134778, 8141532, 8132951, 8145946, 8133361,
 8129611, 8137788, 8140157, 8146085,]
	lm,lg = readfile_metgas_bin(lc, pfilter=mfilter, parts_at_once=10000)
	for p in parts_no:
		val = traj[p]
		ppl = mlab.plot3d(val["x"], val["y"], val["z"], val["t"], tube_radius=0.025, colormap='cool');
		mlab.colorbar(ppl)
		#for g in gas:
		#	mlab.points3d(g.x[numpy.where(g.n == p)],g.y[numpy.where(g.n == p)],g.z[numpy.where(g.n == p)],scale_factor=lm.d, colormap='cool')
		#	mlab.text(color=(1,0,0),width=0.06,x = g.x[numpy.where(g.n == p)][0],y= g.y[numpy.where(g.n == p)][0],z = g.z[numpy.where(g.n == p)][0],text = str(g.t[numpy.where(g.n == p)][0]))
	#mlab.points3d(lg.x, lg.y, lg.z, lg.t, scale_mode="none",scale_factor=lg.d, colormap="cool")
	
	mscat = mlab.pipeline.scalar_scatter(lm.x, lm.y, lm.z)
	mgauss = mlab.pipeline.gaussian_splatter(mscat)

	mlab.pipeline.iso_surface(mgauss,colormap="black-white",contours=[0.9999,],opacity = 1)
	#mlab.points3d(lm.x, lm.y, lm.z, lm.t, scale_mode="none",scale_factor=lm.d, colormap="copper")
	#for val in traj.values():
	#	
		#print "Drawing metal"
		#metp = mlab.points3d(metal.x,metal.y,metal.z,metal.v,scale_mode="none",scale_factor=metal.d, colormap="copper",mode = "point",mask_points = 100)
		#print "Drawing gas"
		#gasp = mlab.points3d(gas.x,gas.y,gas.z,gas.v,scale_mode="none",scale_factor=gas.d,colormap="cool")
		#print "saving to ./vid/{num:02d}.png".format(num=i)
		#mlab.savefig("./vid/{num:02d}.png".format(num=i))
		#mlab.clf()
	mlab.show()
Exemple #2
0
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)