diff options
author | Stan Seibert <stan@mtrr.org> | 2011-08-08 15:37:21 -0400 |
---|---|---|
committer | Stan Seibert <stan@mtrr.org> | 2011-08-08 15:37:21 -0400 |
commit | fd2cba0f96e2d145e6a2b6e3df91cb6e942c114c (patch) | |
tree | bcb6b902c10d8cafa00e228b634e5a0fbd6bf6ae /solids/pmts.py | |
parent | 09e042b8888342ed8fc7a8c5b05ea1caa47a3842 (diff) | |
parent | ed642493fccbcf13efef5491f73241c6a9434ad8 (diff) | |
download | chroma-fd2cba0f96e2d145e6a2b6e3df91cb6e942c114c.tar.gz chroma-fd2cba0f96e2d145e6a2b6e3df91cb6e942c114c.tar.bz2 chroma-fd2cba0f96e2d145e6a2b6e3df91cb6e942c114c.zip |
Merge Tony's changes.
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 |