diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_fileio.py | 3 | ||||
-rw-r--r-- | tests/test_pdf.py | 8 | ||||
-rw-r--r-- | tests/test_propagation.py | 3 | ||||
-rw-r--r-- | tests/test_rayleigh.py | 5 |
4 files changed, 13 insertions, 6 deletions
diff --git a/tests/test_fileio.py b/tests/test_fileio.py index 2911976..3869a9f 100644 --- a/tests/test_fileio.py +++ b/tests/test_fileio.py @@ -5,7 +5,8 @@ import numpy as np class TestFileIO(unittest.TestCase): def test_file_write_and_read(self): - ev = event.Event(1, event.Vertex('e-', (0,0,1), (1,0,0), (0,1,0), 15)) + ev = event.Event(1, event.Vertex('e-', pos=(0,0,1), dir=(1,0,0), + ke=15.0, pol=(0,1,0))) photons_beg = root.make_photon_with_arrays(1) photons_beg.pos[0] = (1,2,3) diff --git a/tests/test_pdf.py b/tests/test_pdf.py index c7c9394..571cbd4 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -11,7 +11,7 @@ from chroma.sim import Simulation class TestPDF(unittest.TestCase): def setUp(self): - self.detector = chroma.detectors.find("microlbne") + self.detector = chroma.detectors.microlbne() self.detector.build() self.vertex_gen = constant_particle_gun('e-', (0,0,0), (1,0,0), 10) @@ -19,7 +19,9 @@ class TestPDF(unittest.TestCase): '''Create a hit count and (q,t) PDF for 10 MeV events in MicroLBNE''' g4generator = G4ParallelGenerator(1, water_wcsim) - gpu_instance = gpu.GPU(0) + + context = gpu.create_cuda_context() + gpu_geometry = gpu.GPUGeometry(self.detector) nthreads_per_block, max_blocks = 64, 1024 @@ -48,6 +50,8 @@ class TestPDF(unittest.TestCase): for i, nhits in enumerate(hitcount): self.assertEqual(nhits, pdf[i].sum()) + context.pop() + def testSimPDF(self): sim = Simulation(self.detector) diff --git a/tests/test_propagation.py b/tests/test_propagation.py index 8f9d084..43ecb9b 100644 --- a/tests/test_propagation.py +++ b/tests/test_propagation.py @@ -20,7 +20,8 @@ class TestPropagation(unittest.TestCase): cube = Geometry(vacuum) cube.add_solid(Solid(box(100,100,100), vacuum, vacuum)) cube.pmtids = [0] - sim = Simulation(cube, bvh_bits=4, geant4_processes=0, use_cache=False) + cube.build(use_cache=False) + sim = Simulation(cube, geant4_processes=0) # Create initial photons nphotons = 10000 diff --git a/tests/test_rayleigh.py b/tests/test_rayleigh.py index 7e5fc92..02ccb41 100644 --- a/tests/test_rayleigh.py +++ b/tests/test_rayleigh.py @@ -16,8 +16,9 @@ class TestRayleigh(unittest.TestCase): self.cube = Geometry(water_wcsim) self.cube.add_solid(Solid(box(100,100,100), water_wcsim, water_wcsim)) self.cube.pmtids = [0] - self.sim = Simulation(self.cube, bvh_bits=4, geant4_processes=0, - use_cache=False) + self.cube.build(use_cache=False) + self.sim = Simulation(self.cube, geant4_processes=0) + nphotons = 100000 pos = np.tile([0,0,0], (nphotons,1)).astype(np.float32) dir = np.tile([0,0,1], (nphotons,1)).astype(np.float32) |