summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-10-05 17:37:26 -0400
committerStan Seibert <stan@mtrr.org>2011-10-05 17:37:26 -0400
commite4ea02720991b5e923e0b7b1045709aff0d6b0c0 (patch)
tree461db2be1fdb4e3b543837c2f3832e0e50f7f7ca /test
parentc309d251232c45bb497da4859eb8cf1b2ab47417 (diff)
downloadchroma-e4ea02720991b5e923e0b7b1045709aff0d6b0c0.tar.gz
chroma-e4ea02720991b5e923e0b7b1045709aff0d6b0c0.tar.bz2
chroma-e4ea02720991b5e923e0b7b1045709aff0d6b0c0.zip
Epic port of Chroma from units of meters/seconds/MeV to
millimeters/nanoseconds/MeV in order to match GEANT4, and also avoid huge discrepancies in magnitude caused by values like 10e-9 sec. Along the way, cleaned up a few things: * Switch the PI and SPEED_OF_LIGHT constants from double to single precision. This avoid some unnecessary double precision calculations in the GPU code. * Fixed a silly problem in the definition of the spherical spiral. Now the demo detector looks totally awesome. Also wrapped it in a black surface. Demo detector now has 10055 PMTs. * Updated the test_ray_intersection data file to reflect the new units. * Fix a missing import in chroma.gpu.tools
Diffstat (limited to 'test')
-rw-r--r--test/data/ray_intersection.npybin0 -> 1920080 bytes
-rw-r--r--test/data/ray_intersection.npzbin1920080 -> 0 bytes
-rw-r--r--test/test_ray_intersection.py6
3 files changed, 4 insertions, 2 deletions
diff --git a/test/data/ray_intersection.npy b/test/data/ray_intersection.npy
new file mode 100644
index 0000000..43f51c2
--- /dev/null
+++ b/test/data/ray_intersection.npy
Binary files differ
diff --git a/test/data/ray_intersection.npz b/test/data/ray_intersection.npz
deleted file mode 100644
index fba0e40..0000000
--- a/test/data/ray_intersection.npz
+++ /dev/null
Binary files differ
diff --git a/test/test_ray_intersection.py b/test/test_ray_intersection.py
index ce364e0..8a33ac3 100644
--- a/test/test_ray_intersection.py
+++ b/test/test_ray_intersection.py
@@ -9,7 +9,7 @@ class TestRayIntersection(unittest.TestCase):
self.context = chroma.gpu.create_cuda_context()
self.module = chroma.gpu.get_cu_module('mesh.h')
self.gpu_funcs = chroma.gpu.GPUFuncs(self.module)
- self.box = chroma.gpu.GPUGeometry(chroma.build(chroma.make.cube()))
+ self.box = chroma.gpu.GPUGeometry(chroma.build(chroma.make.cube(size=1000.0)))
pos, dir = chroma.project.from_film()
self.pos_gpu = ga.to_gpu(chroma.gpu.to_float3(pos))
@@ -17,10 +17,12 @@ class TestRayIntersection(unittest.TestCase):
testdir = os.path.dirname(os.path.abspath(__file__))
self.dx_standard = np.load(os.path.join(testdir,
- 'data/ray_intersection.npz'))
+ 'data/ray_intersection.npy'))
+
def test_intersection_distance(self):
dx = ga.zeros(self.pos_gpu.size, dtype=np.float32)
self.gpu_funcs.distance_to_mesh(np.int32(self.pos_gpu.size), self.pos_gpu, self.dir_gpu, self.box.gpudata, dx, block=(64,1,1), grid=(self.pos_gpu.size//64+1,1))
+
self.assertTrue((dx.get() == self.dx_standard).all())
def tearDown(self):