From 5b6ddaadfbcea436dfdc1e736f7da7763438dc45 Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Mon, 20 Jun 2011 16:33:59 -0400 Subject: pack material and surface indices into the fourth byte of the triangle array on the GPU. you can now take a screenshot of an image rendered with view.py() by pressing the f12 key. --- track.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'track.py') diff --git a/track.py b/track.py index f73f2ed..6f53c09 100644 --- a/track.py +++ b/track.py @@ -1,7 +1,7 @@ import numpy as np import pycuda.driver as cuda from gputhread import GPUThread -from detectors import LBNE +from detectors import minilbne from Queue import Queue from threadtest import create_job import matplotlib.pyplot as plt @@ -10,20 +10,18 @@ from color import map_wavelength from solids import r7081 from geometry import Geometry -nphotons = 100000 +nphotons = 1000 jobs = Queue() output = Queue() -#geometry = LBNE() -geometry = Geometry() -geometry.add_solid(r7081, displacement=(0,-1,0)) +geometry = minilbne geometry.build(bits=8) cuda.init() try: - gputhread = GPUThread(0, geometry, jobs, output, 64) + gputhread = GPUThread(5, geometry, jobs, output, 64) gputhread.start() job = create_job((0,0,0), nphotons) @@ -46,7 +44,7 @@ finally: gputhread.stop() gputhread.join() -mask = job.states != 0 +mask = job.states == 2 rgb = (map_wavelength(job.wavelengths[mask])*255).astype(np.uint32) @@ -56,5 +54,5 @@ def format_hex_string(s): colors = map(format_hex_string, map(hex, rgb[:,0] << 16 | rgb[:,1] << 8 | rgb[:,2])) plt.figure() -plt.plot(*roundrobin(x[mask,:,0], x[mask,:,1], colors)) +plt.plot(*roundrobin(x[mask,:,0], x[mask,:,2], colors)) plt.show() -- cgit