diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-05-18 18:29:43 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-05-18 18:29:43 -0400 |
commit | 3a0571534185505a38dc992a7e21a3eb027aae97 (patch) | |
tree | c60b21f5b6fcc803a9f59c2fcd2d70a42c148600 /photon.py | |
parent | 9306f888fea903accf827870a122a2f6f76e472e (diff) | |
download | chroma-3a0571534185505a38dc992a7e21a3eb027aae97.tar.gz chroma-3a0571534185505a38dc992a7e21a3eb027aae97.tar.bz2 chroma-3a0571534185505a38dc992a7e21a3eb027aae97.zip |
added test likelihood
Diffstat (limited to 'photon.py')
-rw-r--r-- | photon.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,6 +1,6 @@ import numpy as np -def uniform_sphere(size=None): +def uniform_sphere(size=None, dtype=np.double): """ Generate random points isotropically distributed across the unit sphere. @@ -17,13 +17,13 @@ def uniform_sphere(size=None): c = np.sqrt(1-u**2) - points = np.empty((x.size, 3)) + if size is None: + return np.array([c*np.cos(theta), c*np.sin(theta), u]) + + points = np.empty((size, 3), dtype) points[:,0] = c*np.cos(theta) points[:,1] = c*np.sin(theta) points[:,2] = u - if size is None: - return points[0] - else: - return points + return points |