aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-03-26 14:05:59 +0530
committerArun Isaac2021-03-26 14:05:59 +0530
commite502db575fe706fc2d987807bacacc430114a171 (patch)
tree4a86333c62f68207fff9e0d1a7d894ff1ae6bcc6
parent4c18bbb66f40d1aeb52534517cd0afbd74c2eb61 (diff)
downloadsambal-e502db575fe706fc2d987807bacacc430114a171.tar.gz
sambal-e502db575fe706fc2d987807bacacc430114a171.tar.lz
sambal-e502db575fe706fc2d987807bacacc430114a171.zip
Rename random_vector_on_sphere to random_on_sphere.
* src/sambal/sambal.py (random_vector_on_sphere): Rename to random_on_sphere. (random_vector_on_disk): Call random_on_sphere instead of random_vector_on_sphere.
-rw-r--r--src/sambal/sambal.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sambal/sambal.py b/src/sambal/sambal.py
index 8e57cca..fbb2025 100644
--- a/src/sambal/sambal.py
+++ b/src/sambal/sambal.py
@@ -21,7 +21,7 @@ from numpy.random import randn, random
from numpy.linalg import norm
from scipy.special import betainc, betaincinv
-def random_vector_on_sphere(dim):
+def random_on_sphere(dim):
"""Return a random vector uniformly distributed on the unit sphere."""
x = randn(dim)
return x / norm(x)
@@ -78,7 +78,7 @@ def random_vector_on_disk(axis, planar_angle):
disk."""
dim = axis.size
x = empty(dim)
- x[:-1] = sin(planar_angle) * random_vector_on_sphere(dim - 1)
+ x[:-1] = sin(planar_angle) * random_on_sphere(dim - 1)
x[-1] = cos(planar_angle)
return rotate_from_nth_canonical(x, axis)