summaryrefslogtreecommitdiff
path: root/detectors/sno.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-08-16 17:07:52 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-08-16 17:07:52 -0400
commit54d7d1efe215337d121813e27cd4909b9a76e912 (patch)
tree7865db28adf2f9328fb9dcbbca8f8f125ecad40c /detectors/sno.py
parentfd2e841c4c40f9e46258ac8d11c32c2204cddd5b (diff)
downloadchroma-54d7d1efe215337d121813e27cd4909b9a76e912.tar.gz
chroma-54d7d1efe215337d121813e27cd4909b9a76e912.tar.bz2
chroma-54d7d1efe215337d121813e27cd4909b9a76e912.zip
add linear_extrude() function to make.py. rotate_extrude() now takes the number of rotational steps to extrude instead of the angle step size. updated documention in make.py.
Diffstat (limited to 'detectors/sno.py')
-rw-r--r--detectors/sno.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/detectors/sno.py b/detectors/sno.py
index 156dcbe..3e748b4 100644
--- a/detectors/sno.py
+++ b/detectors/sno.py
@@ -9,7 +9,7 @@ from solids import build_8inch_pmt_with_lc
from transform import rotate, make_rotation_matrix
import os
-def sno_vessel(sphere_radius, neck_radius, neck_top, angle_step=math.pi/20):
+def sno_vessel(sphere_radius, neck_radius, neck_top, nsteps=40):
'''Compute the 2D coordinates of the profile of one side of a
SNO-style acrylic vessel. The center of the sphere is at (0,0), with
the neck extending along the positive y direction.
@@ -17,7 +17,7 @@ def sno_vessel(sphere_radius, neck_radius, neck_top, angle_step=math.pi/20):
sphere_radius: Radius of spherical part of profile
neck_radius: Radius of neck part
neck_top: y coordinate of top of neck
- angle_step: angular step size (radius) between points on the sphere
+ nsteps: number of points around the circumference of the sphere
Returns: Tuple of x and y coordinate numpy arrays.
'''
@@ -31,7 +31,7 @@ def sno_vessel(sphere_radius, neck_radius, neck_top, angle_step=math.pi/20):
raise ValueError('neck_top must be greater than the y-value where the sphere and cylinder intersect')
# Start with point at bottom
- angles = np.arange(-math.pi/2, max_angle, angle_step)
+ angles = np.linspace(-math.pi/2, max_angle, nsteps)
x = list(np.cos(angles) * sphere_radius)
y = list(np.sin(angles) * sphere_radius)
x[0] = 0.0 # Round-off error might make cos(-pi/2) not exactly zero
@@ -52,19 +52,19 @@ def sno_vessel(sphere_radius, neck_radius, neck_top, angle_step=math.pi/20):
##### SNO Parts
-angle_step = math.pi/20
+nsteps = 40
av_outside_profile = sno_vessel(sphere_radius=6.0604, neck_radius=0.79375,
- neck_top=10.50, angle_step=angle_step)
+ neck_top=10.50, nsteps=nsteps)
# For simplicity, cap the top of the AV with acrylic
av_inside_profile = sno_vessel(sphere_radius=6.0053, neck_radius=0.72898,
- neck_top=10.00, angle_step=angle_step)
+ neck_top=10.00, nsteps=nsteps)
av_outside_mesh = rotate_extrude(av_outside_profile[0], av_outside_profile[1],
- angle_step)
+ nsteps)
av_outside_mesh.vertices = rotate(av_outside_mesh.vertices, np.pi/2, (-1,0,0))
av_inside_mesh = rotate_extrude(av_inside_profile[0], av_inside_profile[1],
- angle_step)
+ nsteps)
av_inside_mesh.vertices = rotate(av_inside_mesh.vertices, np.pi/2, (-1,0,0))
dir = os.path.split(os.path.realpath(__file__))[0]