diff options
Diffstat (limited to 'solids/pmts.py')
-rw-r--r-- | solids/pmts.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/solids/pmts.py b/solids/pmts.py index 22d9d67..a30d007 100644 --- a/solids/pmts.py +++ b/solids/pmts.py @@ -27,7 +27,24 @@ def build_light_collector(pmt, a, b, d, rmin, rmax, npoints=10): lc_mesh = rotate_extrude(lc_radii, lc_profile + lc_offset, pmt.theta) - return Solid(lc_mesh, pmt.outer_material, pmt.outer_material, color=0xff0000, surface=shiny_surface) + return Solid(lc_mesh, pmt.outer_material, pmt.outer_material, surface=shiny_surface) + +def build_pmt_shell(filename, outer_material=water, theta=np.pi/8): + profile = read_csv(filename) + + # slice profile in half + profile = profile[profile[:,0] < 0] + profile[:,0] = -profile[:,0] + # order profile from base to face + profile = profile[np.argsort(profile[:,1])] + # set x coordinate to 0.0 for first and last profile along the profile + # so that the mesh is closed + profile[0,0] = 0.0 + profile[-1,0] = 0.0 + # convert mm -> m + profile /= 1000.0 + + return Solid(rotate_extrude(profile[:,0], profile[:,1], theta), glass, outer_material, color=0xeeffffff) def build_pmt(filename, glass_thickness, outer_material=water, theta=np.pi/8): profile = read_csv(filename) @@ -72,6 +89,5 @@ def build_light_collector_from_file(filename, outer_material, theta=np.pi/24): profile /= 1000.0 mesh = rotate_extrude(profile[:,0], profile[:,1], theta) - solid = Solid(mesh, outer_material, outer_material, color=0xFF0000, - surface=shiny_surface) + solid = Solid(mesh, outer_material, outer_material, surface=shiny_surface) return solid |