diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-24 15:57:39 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-24 15:57:39 -0400 |
commit | aa0f12c8b6c6d4e0858d46eba5499d9682ecbe9d (patch) | |
tree | 9416de3109ad4692e0d7ade5c0853ce3ecde6040 /solids | |
parent | d63d0d0cd84519b7c0bd7f6b576bd0f24ff22dc2 (diff) | |
download | chroma-aa0f12c8b6c6d4e0858d46eba5499d9682ecbe9d.tar.gz chroma-aa0f12c8b6c6d4e0858d46eba5499d9682ecbe9d.tar.bz2 chroma-aa0f12c8b6c6d4e0858d46eba5499d9682ecbe9d.zip |
argument '-j' to threadtest.py now specifies a list of device ids to be used. GPUThread objects now shallow copy the geometry so that threads are not writing to the same memory when the geometry is loaded onto the gpu. the model number for the 12" Hamamatsu PMT is R11708, not r7081 (which is the model for the 10" PMT); all references to the 12" PMT were changed accordingly. only allocate space for 20 materials and 20 surfaces on the gpu instead of 100 to save some space. started to modify track.py to build its own photons and module since the GPUThread object only copies photon hit times back from the gpu (not track information), but I am waiting to find out if pycuda GPUArrays can be used with vector types.
Diffstat (limited to 'solids')
-rw-r--r-- | solids/__init__.py | 4 | ||||
-rw-r--r-- | solids/r11708.py | 48 | ||||
-rw-r--r-- | solids/r11708_cut.py | 48 | ||||
-rw-r--r-- | solids/r7081.py | 48 | ||||
-rw-r--r-- | solids/r7081_cut.py | 48 |
5 files changed, 98 insertions, 98 deletions
diff --git a/solids/__init__.py b/solids/__init__.py index 8fc66a4..f4c5812 100644 --- a/solids/__init__.py +++ b/solids/__init__.py @@ -1,2 +1,2 @@ -from r7081 import r7081 -from r7081_cut import r7081_cut +from r11708 import r11708 +from r11708_cut import r11708_cut diff --git a/solids/r11708.py b/solids/r11708.py new file mode 100644 index 0000000..a0476d0 --- /dev/null +++ b/solids/r11708.py @@ -0,0 +1,48 @@ +import os +import sys +import numpy as np + +dir = os.path.split(os.path.realpath(__file__))[0] +sys.path.append(dir + '/..') + +import models +from stl import mesh_from_stl +from geometry import * +from materials import * + +r11708_outer_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_outer.stl') +r11708_inner_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_inner.stl') + +photocathode_triangles = np.mean(r11708_inner_mesh[:], axis=1)[:,1] > 0 + +inner_color = np.empty(len(r11708_inner_mesh.triangles), np.uint32) +inner_color[photocathode_triangles] = 0xff0000 +inner_color[~photocathode_triangles] = 0x00ff00 + +inner_surface = np.empty(len(r11708_inner_mesh.triangles), np.object) +inner_surface[photocathode_triangles] = black_surface +inner_surface[~photocathode_triangles] = shiny_surface + +r11708_inner_solid = Solid(r11708_inner_mesh, vacuum, glass, inner_surface, color=inner_color) +r11708_outer_solid = Solid(r11708_outer_mesh, glass, lightwater_sno) + +r11708 = r11708_inner_solid + r11708_outer_solid + +if __name__ == '__main__': + from view import view + from copy import deepcopy + + r11708_outer_mesh_cutaway = deepcopy(r11708_outer_mesh) + r11708_outer_mesh_cutaway.triangles = \ + r11708_outer_mesh_cutaway.triangles[\ + np.mean(r11708_outer_mesh_cutaway[:], axis=1)[:,0] > 0] + + r11708_outer_solid_cutaway = Solid(r11708_outer_mesh_cutaway, glass, lightwater_sno) + + r11708_cutaway = r11708_inner_solid + r11708_outer_solid_cutaway + + geometry = Geometry() + geometry.add_solid(r11708_cutaway) + geometry.build(bits=8) + + view(geometry, 'r11708_cutaway') diff --git a/solids/r11708_cut.py b/solids/r11708_cut.py new file mode 100644 index 0000000..a9ffeba --- /dev/null +++ b/solids/r11708_cut.py @@ -0,0 +1,48 @@ +import os +import sys +import numpy as np + +dir = os.path.split(os.path.realpath(__file__))[0] +sys.path.append(dir + '/..') + +import models +from stl import mesh_from_stl +from geometry import * +from materials import * + +r11708_outer_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_outer_cut.stl') +r11708_inner_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_inner_cut.stl') + +photocathode_triangles = np.mean(r11708_inner_mesh[:], axis=1)[:,1] > 0 + +inner_color = np.empty(len(r11708_inner_mesh.triangles), np.uint32) +inner_color[photocathode_triangles] = 0xff0000 +inner_color[~photocathode_triangles] = 0x00ff00 + +inner_surface = np.empty(len(r11708_inner_mesh.triangles), np.object) +inner_surface[photocathode_triangles] = black_surface +inner_surface[~photocathode_triangles] = shiny_surface + +r11708_inner_solid = Solid(r11708_inner_mesh, vacuum, glass, inner_surface, color=inner_color) +r11708_outer_solid = Solid(r11708_outer_mesh, glass, lightwater_sno) + +r11708_cut = r11708_inner_solid + r11708_outer_solid + +if __name__ == '__main__': + from view import view + from copy import deepcopy + + r11708_outer_mesh_cutaway = deepcopy(r11708_outer_mesh) + r11708_outer_mesh_cutaway.triangles = \ + r11708_outer_mesh_cutaway.triangles[\ + np.mean(r11708_outer_mesh_cutaway[:], axis=1)[:,0] > 0] + + r11708_outer_solid_cutaway = Solid(r11708_outer_mesh_cutaway, glass, lightwater_sno) + + r11708_cutaway = r11708_inner_solid + r11708_outer_solid_cutaway + + geometry = Geometry() + geometry.add_solid(r11708_cutaway) + geometry.build(bits=8) + + view(geometry, 'r11708_cutaway') diff --git a/solids/r7081.py b/solids/r7081.py deleted file mode 100644 index ed677d8..0000000 --- a/solids/r7081.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import sys -import numpy as np - -dir = os.path.split(os.path.realpath(__file__))[0] -sys.path.append(dir + '/..') - -import models -from stl import mesh_from_stl -from geometry import * -from materials import * - -r7081_outer_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_outer.stl') -r7081_inner_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_inner.stl') - -photocathode_triangles = np.mean(r7081_inner_mesh[:], axis=1)[:,1] > 0 - -inner_color = np.empty(len(r7081_inner_mesh.triangles), np.uint32) -inner_color[photocathode_triangles] = 0xff0000 -inner_color[~photocathode_triangles] = 0x00ff00 - -inner_surface = np.empty(len(r7081_inner_mesh.triangles), np.object) -inner_surface[photocathode_triangles] = black_surface -inner_surface[~photocathode_triangles] = shiny_surface - -r7081_inner_solid = Solid(r7081_inner_mesh, vacuum, glass, inner_surface, color=inner_color) -r7081_outer_solid = Solid(r7081_outer_mesh, glass, lightwater_sno) - -r7081 = r7081_inner_solid + r7081_outer_solid - -if __name__ == '__main__': - from view import view - from copy import deepcopy - - r7081_outer_mesh_cutaway = deepcopy(r7081_outer_mesh) - r7081_outer_mesh_cutaway.triangles = \ - r7081_outer_mesh_cutaway.triangles[\ - np.mean(r7081_outer_mesh_cutaway[:], axis=1)[:,0] > 0] - - r7081_outer_solid_cutaway = Solid(r7081_outer_mesh_cutaway, glass, lightwater_sno) - - r7081_cutaway = r7081_inner_solid + r7081_outer_solid_cutaway - - geometry = Geometry() - geometry.add_solid(r7081_cutaway) - geometry.build(bits=8) - - view(geometry, 'r7081_cutaway') diff --git a/solids/r7081_cut.py b/solids/r7081_cut.py deleted file mode 100644 index d38d54b..0000000 --- a/solids/r7081_cut.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import sys -import numpy as np - -dir = os.path.split(os.path.realpath(__file__))[0] -sys.path.append(dir + '/..') - -import models -from stl import mesh_from_stl -from geometry import * -from materials import * - -r7081_outer_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_outer_cut.stl') -r7081_inner_mesh = mesh_from_stl(models.dir + '/hamamatsu_12inch_inner_cut.stl') - -photocathode_triangles = np.mean(r7081_inner_mesh[:], axis=1)[:,1] > 0 - -inner_color = np.empty(len(r7081_inner_mesh.triangles), np.uint32) -inner_color[photocathode_triangles] = 0xff0000 -inner_color[~photocathode_triangles] = 0x00ff00 - -inner_surface = np.empty(len(r7081_inner_mesh.triangles), np.object) -inner_surface[photocathode_triangles] = black_surface -inner_surface[~photocathode_triangles] = shiny_surface - -r7081_inner_solid = Solid(r7081_inner_mesh, vacuum, glass, inner_surface, color=inner_color) -r7081_outer_solid = Solid(r7081_outer_mesh, glass, lightwater_sno) - -r7081_cut = r7081_inner_solid + r7081_outer_solid - -if __name__ == '__main__': - from view import view - from copy import deepcopy - - r7081_outer_mesh_cutaway = deepcopy(r7081_outer_mesh) - r7081_outer_mesh_cutaway.triangles = \ - r7081_outer_mesh_cutaway.triangles[\ - np.mean(r7081_outer_mesh_cutaway[:], axis=1)[:,0] > 0] - - r7081_outer_solid_cutaway = Solid(r7081_outer_mesh_cutaway, glass, lightwater_sno) - - r7081_cutaway = r7081_inner_solid + r7081_outer_solid_cutaway - - geometry = Geometry() - geometry.add_solid(r7081_cutaway) - geometry.build(bits=8) - - view(geometry, 'r7081_cutaway') |