summaryrefslogtreecommitdiff
path: root/track.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-06-20 16:33:59 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-06-20 16:33:59 -0400
commit5b6ddaadfbcea436dfdc1e736f7da7763438dc45 (patch)
tree27d3f4d3903d2cd00449026acd23ad6de1419cd5 /track.py
parenta149f96a766c4d8d63919535cc468c539036165e (diff)
downloadchroma-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.py14
1 files changed, 6 insertions, 8 deletions
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()