diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-08 11:03:07 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-08 11:03:07 -0400 |
commit | f6109fc8939c55a9ef8244806d00b3ee07ee1b13 (patch) | |
tree | 0a3d84cc5fb29412743999b3d28654442389422f /solids | |
parent | 3a8a4c4dd095ff25a1dbe70e387e166f43a5644b (diff) | |
download | chroma-f6109fc8939c55a9ef8244806d00b3ee07ee1b13.tar.gz chroma-f6109fc8939c55a9ef8244806d00b3ee07ee1b13.tar.bz2 chroma-f6109fc8939c55a9ef8244806d00b3ee07ee1b13.zip |
add a simple event viewer. view events by running ./camera.py <detector_name> -i <name_of_io_file>.
Diffstat (limited to 'solids')
-rw-r--r-- | solids/__init__.py | 6 | ||||
-rw-r--r-- | solids/pmts.py | 22 |
2 files changed, 24 insertions, 4 deletions
diff --git a/solids/__init__.py b/solids/__init__.py index 479bacd..46f3119 100644 --- a/solids/__init__.py +++ b/solids/__init__.py @@ -1,6 +1,6 @@ import numpy as np -from pmts import build_pmt, build_light_collector, build_light_collector_from_file +from pmts import build_pmt, build_light_collector, build_light_collector_from_file, build_pmt_shell import os import sys @@ -15,6 +15,10 @@ from view import buildable def build_12inch_pmt(outer_material=water, theta=np.pi/8): return build_pmt(dir + '/hamamatsu_12inch.txt', 0.003, outer_material, theta) +@buildable('12inch_pmt_shell') +def build_12inch_pmt_shell(outer_material=water, theta=np.pi/8): + return build_pmt_shell(dir + '/hamamatsu_12inch.txt') + # from Jelena Maricic lc_12inch_a = 0.16597 lc_12inch_b = 0.584525 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 |