diff options
| author | Stan Seibert <stan@mtrr.org> | 2011-09-19 14:36:13 -0400 |
|---|---|---|
| committer | Stan Seibert <stan@mtrr.org> | 2011-09-19 14:36:13 -0400 |
| commit | a21b05e4727403e2e061234289af9e60e6022e5a (patch) | |
| tree | 7a7d4c5809c370f3e542cfc8cb0bec7c2e4f5cdc /chroma/solids | |
| parent | cfecff941fc619eb7269128afc62d9c11ae78aff (diff) | |
| parent | a38c56ff1e268298568077af7f03c8ac64c6fb82 (diff) | |
| download | chroma-a21b05e4727403e2e061234289af9e60e6022e5a.tar.gz chroma-a21b05e4727403e2e061234289af9e60e6022e5a.tar.bz2 chroma-a21b05e4727403e2e061234289af9e60e6022e5a.zip | |
merge relayout branch
Diffstat (limited to 'chroma/solids')
| -rw-r--r-- | chroma/solids/__init__.py | 39 | ||||
| -rw-r--r-- | chroma/solids/hamamatsu_12inch.txt | 55 | ||||
| -rw-r--r-- | chroma/solids/pmts.py | 87 | ||||
| -rw-r--r-- | chroma/solids/sno_cone.txt | 21 | ||||
| -rw-r--r-- | chroma/solids/sno_pmt.txt | 121 | ||||
| -rw-r--r-- | chroma/solids/sno_pmt_reduced.txt | 47 |
6 files changed, 370 insertions, 0 deletions
diff --git a/chroma/solids/__init__.py b/chroma/solids/__init__.py new file mode 100644 index 0000000..c4d227f --- /dev/null +++ b/chroma/solids/__init__.py @@ -0,0 +1,39 @@ +from pmts import build_pmt, build_light_collector, build_light_collector_from_file, build_pmt_shell +from chroma.optics import * +from os.path import dirname + +def build_12inch_pmt(outer_material=water, nsteps=16): + return build_pmt(dirname(__file__) + '/hamamatsu_12inch.txt', 0.003, + outer_material, nsteps) + +def build_12inch_pmt_shell(outer_material=water, nsteps=16): + return build_pmt_shell(dirname(__file__) + '/hamamatsu_12inch.txt') + +# from Jelena Maricic +lc_12inch_a = 0.16597 +lc_12inch_b = 0.584525 +lc_12inch_d = 0.09548 +lc_12inch_rmin = 0.1524 +lc_12inch_rmax = 0.235072 + +def build_12inch_pmt_with_lc(outer_material=water, nsteps=16): + pmt = build_12inch_pmt(outer_material, nsteps) + return pmt + build_light_collector(pmt, a=lc_12inch_a, b=lc_12inch_b, + d=lc_12inch_d, rmin=lc_12inch_rmin, + rmax=lc_12inch_rmax) + +def build_12inch_pmt_with_lc_hd(outer_material=water, nsteps=128): + pmt = build_12inch_pmt(outer_material, nsteps) + return pmt + build_light_collector(pmt, a=lc_12inch_a, b=lc_12inch_b, + d=lc_12inch_d, rmin=lc_12inch_rmin, + rmax=lc_12inch_rmax, npoints=100) + +def build_8inch_pmt(outer_material=water, nsteps=24): + return build_pmt(dirname(__file__) + '/sno_pmt.txt', 0.003, + outer_material, nsteps) + +def build_8inch_pmt_with_lc(outer_material=water, nsteps=24): + pmt = build_8inch_pmt(outer_material, nsteps) + lc = build_light_collector_from_file(dirname(__file__) + '/sno_cone.txt', + outer_material, nsteps) + return pmt + lc diff --git a/chroma/solids/hamamatsu_12inch.txt b/chroma/solids/hamamatsu_12inch.txt new file mode 100644 index 0000000..e896b94 --- /dev/null +++ b/chroma/solids/hamamatsu_12inch.txt @@ -0,0 +1,55 @@ +#DataThief /Users/stan/Downloads/./Dimension_of_12inch_bulb_100826.png Monday 16-May-2011 12:22:34 PM +109.1514, 83.9786 +123.0527, 70.9583 +134.8946, 56.9466 +145.1919, 40.944 +150.8554, 23.4594 +152.4, 3.9922 +150.8554, -15.4649 +145.7067, -32.914 +136.4392, -49.3517 +123.0527, -64.2787 +108.6364, -75.2102 +92.1608, -86.1349 +76.2, -97.0612 +66.4176, -112.0001 +63.3284, -130.9531 +63.3284, -150.9143 +63.3284, -170.3764 +56.6351, -187.8206 +44.7932, -202.7527 +28.8324, -211.1839 +10.8122, -212.6219 +-9.2676, -213.5543 +-28.8324, -210.995 +-45.823, -201.9569 +-57.6649, -186.9473 +-63.8432, -169.96 +-63.8432, -150.4979 +-63.8432, -130.5367 +-66.4176, -111.0661 +-76.7149, -96.0615 +-93.1905, -85.0289 +-108.6364, -74.4987 +-123.0527, -63.4727 +-135.4095, -49.9586 +-144.677, -33.9593 +-150.3405, -16.4747 +-152.9149, 2.4968 +-151.3703, 21.4549 +-146.2216, 39.4031 +-136.4392, 55.34 +-124.0824, 70.2704 +-109.6662, 83.198 +-93.7054, 94.1244 +-76.7149, 103.0513 +-59.2095, 109.4813 +-40.6743, 113.9119 +-21.1095, 117.3411 +-1.0297, 118.2734 +19.05, 117.2096 +38.6149, 114.1513 +57.15, 109.5994 +75.1703, 103.053 +92.1608, 94.5138 +104.0027, 88.4867 diff --git a/chroma/solids/pmts.py b/chroma/solids/pmts.py new file mode 100644 index 0000000..43aed3f --- /dev/null +++ b/chroma/solids/pmts.py @@ -0,0 +1,87 @@ +import numpy as np +from chroma.geometry import Solid +from chroma.make import rotate_extrude +from chroma.optics import * +from chroma.tools import read_csv, offset + +def get_lc_profile(radii, a, b, d, rmin, rmax): + c = -b*np.sqrt(1 - (rmin-d)**2/a**2) + return -c - b*np.sqrt(1-(radii-d)**2/a**2) + +def build_light_collector(pmt, a, b, d, rmin, rmax, npoints=10): + if not isinstance(pmt, Solid): + raise Exception('`pmt` must be an instance of %s' % Solid) + + lc_radii = np.linspace(rmin, rmax, npoints) + lc_profile = get_lc_profile(lc_radii, a, b, d, rmin, rmax) + + pmt_face_profile = pmt.profile[pmt.profile[:,1] > -1e-3] + + lc_offset = np.interp(lc_radii[0], list(reversed(pmt_face_profile[:,0])), list(reversed(pmt_face_profile[:,1]))) + + lc_mesh = rotate_extrude(lc_radii, lc_profile + lc_offset, pmt.nsteps) + + return Solid(lc_mesh, pmt.outer_material, pmt.outer_material, surface=shiny_surface) + +def build_pmt_shell(filename, outer_material=water, nsteps=16): + 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], nsteps), glass, outer_material, color=0xeeffffff) + +def build_pmt(filename, glass_thickness, outer_material=water, nsteps=16): + 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 + + offset_profile = offset(profile, -glass_thickness) + + outer_envelope_mesh = rotate_extrude(profile[:,0], profile[:,1], nsteps) + inner_envelope_mesh = rotate_extrude(offset_profile[:,0], offset_profile[:,1], nsteps) + + outer_envelope = Solid(outer_envelope_mesh, glass, outer_material) + + photocathode = np.mean(inner_envelope_mesh.assemble(), axis=1)[:,1] > 0 + + inner_envelope = Solid(inner_envelope_mesh, vacuum, glass, surface=np.where(photocathode, r7081hqe_photocathode, shiny_surface), color=np.where(photocathode, 0xff00, 0xff0000)) + + pmt = outer_envelope + inner_envelope + + # profile points, outer_material, and theta are used to construct the + # light collector + pmt.profile = profile + pmt.outer_material = outer_material + pmt.nsteps = nsteps + + return pmt + +def build_light_collector_from_file(filename, outer_material, nsteps=48): + profile = read_csv(filename) + + # Convert mm to m + profile /= 1000.0 + + mesh = rotate_extrude(profile[:,0], profile[:,1], nsteps) + solid = Solid(mesh, outer_material, outer_material, surface=shiny_surface) + return solid diff --git a/chroma/solids/sno_cone.txt b/chroma/solids/sno_cone.txt new file mode 100644 index 0000000..5b56792 --- /dev/null +++ b/chroma/solids/sno_cone.txt @@ -0,0 +1,21 @@ +#DataThief /Users/stan/Downloads/./sno_pmt.png Tuesday 26-Jul-2011 3:33:52 PM +-133.6402, 130.0879 +-133.673, 123.0691 +-133.7058, 116.0503 +-133.0342, 109.7357 +-132.3659, 102.7194 +#-131.6944, 96.4048 +-130.3251, 89.3909 +#-128.2481, 83.7831 +#-126.8788, 76.7691 +-124.8018, 71.1613 +-122.7282, 64.8516 +-119.9503, 59.2462 +-117.1756, 52.9388 +-114.3976, 47.3335 +-111.6197, 41.7281 +-108.1407, 36.1251 +-104.6617, 30.5222 +-100.4816, 24.9216 +-97.5145, 22.2998 + diff --git a/chroma/solids/sno_pmt.txt b/chroma/solids/sno_pmt.txt new file mode 100644 index 0000000..9553505 --- /dev/null +++ b/chroma/solids/sno_pmt.txt @@ -0,0 +1,121 @@ +#DataThief /Users/stan/Downloads/./sno_pmt.png Tuesday 26-Jul-2011 3:31:47 PM +-1.2088, -183.8939 +5.8016, -183.8698 +12.812, -183.8456 +19.8225, -183.8215 +26.8329, -183.7974 +33.8433, -183.7732 +38.0659, -180.2494 +38.0889, -175.3362 +36.7163, -169.0241 +36.749, -162.0053 +36.7818, -154.9865 +36.8145, -147.9677 +36.8473, -140.9489 +36.8801, -133.9301 +37.6139, -126.9089 +38.3477, -119.8877 +36.975, -113.5756 +35.6025, -107.2635 +35.6352, -100.2447 +34.9668, -93.2283 +34.2953, -86.9138 +35.7269, -80.592 +39.2616, -74.263 +43.4908, -69.3354 +48.4178, -65.1072 +54.0359, -62.9823 +60.3584, -60.1531 +62.491, -53.8289 +67.418, -49.6008 +72.3449, -45.3726 +77.2719, -41.1444 +82.9032, -36.212 +89.9136, -36.1878 +91.3418, -30.568 +94.8667, -26.3446 +97.7004, -20.0181 +99.8296, -14.3958 +101.2646, -7.3721 +101.9984, -0.3509 +101.3203, 4.5598 +100.652, 11.5762 +98.5783, 17.8859 +96.5013, 23.4937 +93.7267, 29.801 +90.2477, 35.404 +86.0644, 40.3026 +81.18, 45.1989 +76.2924, 49.3933 +71.4015, 52.8858 +65.8094, 56.376 +60.2176, 59.866 +54.6223, 62.6543 +48.326, 65.4401 +42.7275, 67.5264 +36.428, 69.6104 +30.1252, 70.9924 +23.8223, 72.3745 +16.8185, 73.7541 +10.5124, 74.4343 +3.5051, 75.1121 +-3.5051, 75.0879 +-10.5156, 75.0638 +-16.8316, 73.6383 +-23.8453, 72.9123 +-30.1612, 71.4868 +-36.4804, 69.3595 +-42.7995, 67.2322 +-48.4178, 65.1072 +-54.7403, 62.278 +-60.3617, 59.4512 +-65.983, 56.6244 +-71.6111, 52.3938 +-76.5348, 48.8675 +-82.1628, 44.6369 +-87.093, 39.7069 +-90.6212, 34.7816 +-94.1526, 29.1546 +-97.5145, 22.2998 +-99.1123, 17.9076 +-101.2449, 11.5834 +-101.9787, 4.5622 +-102.0115, -2.4566 +-101.3399, -8.7711 +-100.6716, -15.7875 +-98.5979, -22.0972 +-95.8167, -27.0007 +-93.0421, -33.308 +-88.8587, -38.2067 +-83.9744, -43.1029 +-79.09, -47.9992 +-74.1991, -51.4917 +-69.3082, -54.9843 +-63.7162, -58.4744 +-58.1243, -61.9645 +-52.5257, -64.0508 +-46.9338, -67.5409 +-42.0527, -73.1391 +-39.2715, -78.0426 +-36.4968, -84.3498 +-35.8252, -90.6644 +-37.2601, -97.688 +-37.2894, -104.0049 +-36.6213, -111.0213 +-40.1527, -116.6484 +-40.1822, -122.9654 +-40.2149, -129.9842 +-38.8423, -136.2963 +-38.8751, -143.3151 +-38.9078, -150.3338 +-38.9405, -157.3527 +-38.9734, -164.3715 +-39.0061, -171.3902 +-41.8365, -177.015 +-41.1649, -183.3295 +-34.8588, -184.0097 +#-27.8484, -183.9855 +#-20.838, -183.9614 +#-13.8276, -183.9373 +#-6.8171, -183.9132 +#-3.3119, -183.9011 diff --git a/chroma/solids/sno_pmt_reduced.txt b/chroma/solids/sno_pmt_reduced.txt new file mode 100644 index 0000000..eceaadf --- /dev/null +++ b/chroma/solids/sno_pmt_reduced.txt @@ -0,0 +1,47 @@ +#DataThief /Users/stan/Downloads/./sno_pmt.png Wednesday 27-Jul-2011 11:20:44 AM +#-0.7993, -96.1588 +#13.2215, -96.1106 +#27.2424, -96.0623 +#34.2823, -89.7213 +#37.8465, -77.0754 +#46.3081, -66.5182 +#57.551, -60.8646 +65.305, -51.7136 +75.8632, -42.553 +87.1094, -36.1975 +92.7603, -27.0538 +99.1188, -16.5038 +101.2842, -3.1609 +100.6389, 8.7687 +97.1926, 21.3905 +91.64, 33.3031 +83.2766, 43.8024 +73.498, 51.4893 +62.3141, 58.4695 +51.1237, 64.046 +39.2288, 68.9181 +26.6265, 72.3841 +13.3165, 74.4439 +-0.701, 75.0976 +-14.7219, 75.0493 +-27.3537, 72.1984 +-39.9889, 68.6456 +-51.9295, 63.6914 +-63.8767, 57.3335 +-75.1262, 50.2761 +-84.9801, 41.8197 +-93.4417, 31.2626 +-99.0992, 20.7151 +-101.9656, 7.3697 +-101.3268, -5.9636 +-99.2859, -19.2921 +-94.431, -30.5053 +-86.0677, -41.0045 +-76.2957, -50.0952 +-65.8128, -57.0778 +-54.6256, -63.3562 +#-43.445, -71.0383 +#-37.8858, -81.5472 +#-35.8449, -94.8757 +#-22.5316, -96.2336 +#-8.5108, -96.1854 |
