diff options
author | Stan Seibert <stan@mtrr.org> | 2011-08-12 15:51:20 -0400 |
---|---|---|
committer | Stan Seibert <stan@mtrr.org> | 2011-08-12 15:51:20 -0400 |
commit | 332ec7a527857cc8c5f92c16ee94326b4cbfcbe1 (patch) | |
tree | 6aaf9b4e3a3b2a5b5d2ea35f411cd1f0bd1ec92e | |
parent | 7915bd33e868e8e935f14795215ea50ad4bc4a5b (diff) | |
download | chroma-332ec7a527857cc8c5f92c16ee94326b4cbfcbe1.tar.gz chroma-332ec7a527857cc8c5f92c16ee94326b4cbfcbe1.tar.bz2 chroma-332ec7a527857cc8c5f92c16ee94326b4cbfcbe1.zip |
Segmented cylinder FOR MOAR SPEED! 1.8 Mphotons/sec!
-rw-r--r-- | detectors/lbne.py | 4 | ||||
-rw-r--r-- | make.py | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/detectors/lbne.py b/detectors/lbne.py index 3e27907..d3c12da 100644 --- a/detectors/lbne.py +++ b/detectors/lbne.py @@ -10,7 +10,7 @@ from solids import build_12inch_pmt, build_12inch_pmt_with_lc, build_12inch_pmt_ from optics import * from transform import rotate, make_rotation_matrix from itertools import product -from make import cylinder +from make import cylinder, segmented_cylinder def build_lbne(radius, height, nstrings, pmts_per_string, endcap_spacing, physical_model=True): if physical_model: @@ -21,7 +21,7 @@ def build_lbne(radius, height, nstrings, pmts_per_string, endcap_spacing, physic lbne = Geometry() # outer cylinder - cylinder_mesh = cylinder(radius, radius, height+height/(pmts_per_string-1), theta=(2*np.pi/nstrings)/4) + cylinder_mesh = segmented_cylinder(radius, height+height/(pmts_per_string-1), theta=(2*np.pi/nstrings)/8, n=200) cylinder_mesh.vertices = rotate(cylinder_mesh.vertices, np.pi/2, (-1,0,0)) lbne.add_solid(Solid(cylinder_mesh, water_wcsim, vacuum, black_surface, 0xff0000ff)) @@ -47,6 +47,17 @@ def cylinder(radius1=1, radius2=1, height=2, theta=np.pi/32): y = [-height/2.0, -height/2.0, height/2.0, height/2.0] return rotate_extrude(x, y, theta) +def segmented_cylinder(radius, height=2, theta=np.pi/32, n=50): + x = np.concatenate((np.linspace(0, radius, n, endpoint=False), + [radius] * n, + np.linspace(radius, 0, n, endpoint=False), + [0.0])) + y = np.concatenate(([-height/2.0] * n, + np.linspace(-height/2.0, height/2.0, n, endpoint=False), + [height/2.0] * (n+1))) + #return x,y + return rotate_extrude(x, y, theta, remove_duplicate_vertices=False) + def sphere(radius=1, theta=np.pi/32): profile_angles = np.arange(-np.pi/2, np.pi/2+theta, theta) return rotate_extrude(radius*np.cos(profile_angles), radius*np.sin(profile_angles), theta) |