diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-20 16:33:59 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-20 16:33:59 -0400 |
commit | 5b6ddaadfbcea436dfdc1e736f7da7763438dc45 (patch) | |
tree | 27d3f4d3903d2cd00449026acd23ad6de1419cd5 /track.py | |
parent | a149f96a766c4d8d63919535cc468c539036165e (diff) | |
download | chroma-5b6ddaadfbcea436dfdc1e736f7da7763438dc45.tar.gz chroma-5b6ddaadfbcea436dfdc1e736f7da7763438dc45.tar.bz2 chroma-5b6ddaadfbcea436dfdc1e736f7da7763438dc45.zip |
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.
Diffstat (limited to 'track.py')
-rw-r--r-- | track.py | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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() |