diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-07-19 15:09:50 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-07-19 15:09:50 -0400 |
commit | f5a328b72ebb643b51cae41a991c934da712f0e5 (patch) | |
tree | f90f89c335743d0da239cf413fcca09fb711acd0 /track.py | |
parent | 842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9 (diff) | |
download | chroma-f5a328b72ebb643b51cae41a991c934da712f0e5.tar.gz chroma-f5a328b72ebb643b51cae41a991c934da712f0e5.tar.bz2 chroma-f5a328b72ebb643b51cae41a991c934da712f0e5.zip |
removed STL pmt models; pmt models are now built by calling rotate_extrude() on a profile of the PMT model (see build_pmt() in solids/pmts.py). triangle intersection now allows one of the two coefficients multiplying the vectors which span the triangle to float slightly negative (up to -EPSILON; EPSILON is defined in src/intersect.h) in order to eliminate rays passing through the line between two triangles. cleaned up a lot of unused code. pulled duplicate code in view() and render() into functions in view.py. in order to allow view.py and render.py to search pre-defined geometries, solids, meshes, etc. without requiring them to be pre-built, pre-defined geometries, solids, meshes, etc. should be returned by a function tagged by the decorator @buildable(identifier) defined in view.py, where identifier is a string used to identify the object as an argument to either view.py or render.py. optical materials and surfaces are now defined in optics.py. added an image directory to save cool screenshots.
Diffstat (limited to 'track.py')
-rw-r--r-- | track.py | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/track.py b/track.py deleted file mode 100644 index 101e08e..0000000 --- a/track.py +++ /dev/null @@ -1,65 +0,0 @@ -import numpy as np -import pycuda.driver as cuda -from gputhread import GPUThread -from detectors import minilbne -from Queue import Queue -from threadtest import create_job -import matplotlib.pyplot as plt -from itertoolset import roundrobin -from color import map_wavelength -from solids import r11708 -from geometry import Geometry -import src - -nphotons = 1000 - -jobs = Queue() -output = Queue() - -geometry = minilbne -geometry.build(bits=8) - -cuda.init() - -try: - #gputhread = GPUThread(5, geometry, jobs, output, 64) - #gputhread.start() - - device = cuda.Device(5) - context = device.make_context() - module = SourceModule(src.kernel, options=['-I' + src.dir], no_extern_c=True, cache_dir=False) - - propagate = module.get_function('propagate') - - job = create_job((0,0,0), nphotons) - - x = np.empty((nphotons, 10, 3)) - for i in range(10): - print '%i' % i - x[:,i,0] = job.positions['x'] - x[:,i,1] = job.positions['y'] - x[:,i,2] = job.positions['z'] - - jobs.put(job) - jobs.join() - - job = output.get() - - for j in np.unique(job.states): - print 'state %2i, %i' % (j, len(job.states[job.states == j])) -finally: - gputhread.stop() - gputhread.join() - -mask = job.states == 2 - -rgb = (map_wavelength(job.wavelengths[mask])*255).astype(np.uint32) - -def format_hex_string(s): - return '#' + s.rstrip('L')[2:].zfill(6) - -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,:,2], colors)) -plt.show() |