diff options
author | Arun Isaac | 2021-03-15 15:00:00 +0530 |
---|---|---|
committer | Arun Isaac | 2021-03-15 15:27:40 +0530 |
commit | 73cae57f5fab5e92032916c61523ec79427e8335 (patch) | |
tree | 3fa0f19e8a34b853556f3cd1b04d11b1b6660f85 /contrib | |
parent | d771e8524094493f8a7c8b25b660b18acf837f92 (diff) | |
download | nsmc-73cae57f5fab5e92032916c61523ec79427e8335.tar.gz nsmc-73cae57f5fab5e92032916c61523ec79427e8335.tar.lz nsmc-73cae57f5fab5e92032916c61523ec79427e8335.zip |
Remove space between function name and bracket.
* contrib/cone-vector.py (random_vector_on_sphere,
planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle,
rotate_from_nth_canonical, random_vector_on_spherical_cap): Remove
space between function name and bracket.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cone-vector.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/cone-vector.py b/contrib/cone-vector.py index 1f28d07..9501464 100644 --- a/contrib/cone-vector.py +++ b/contrib/cone-vector.py @@ -21,25 +21,25 @@ from numpy.random import randn, random from numpy.linalg import norm from scipy.special import betainc, betaincinv, gamma -def random_vector_on_sphere (dim): +def random_vector_on_sphere(dim): x = randn(dim) return x / norm(x) -def planar_angle2solid_angle_fraction (planar_angle, dim): +def planar_angle2solid_angle_fraction(planar_angle, dim): alpha = (dim - 1) / 2 beta = 1/2 return where(planar_angle < pi/2, 0.5*betainc(alpha, beta, sin(planar_angle)**2), 1 - 0.5*betainc(alpha, beta, sin(planar_angle)**2)) -def solid_angle_fraction2planar_angle (solid_angle_fraction, dim): +def solid_angle_fraction2planar_angle(solid_angle_fraction, dim): alpha = (dim - 1) / 2 beta = 1/2 return where(solid_angle_fraction < 1/2, arcsin(sqrt(betaincinv(alpha, beta, 2*solid_angle_fraction))), pi - arcsin(sqrt(betaincinv(alpha, beta, 2*(1-solid_angle_fraction))))) -def rotate_from_nth_canonical (x, axis): +def rotate_from_nth_canonical(x, axis): xn = x[-1] axisn = axis[-1] if axisn != 1: @@ -51,7 +51,7 @@ def rotate_from_nth_canonical (x, axis): - axisn*(xn*s + a*(axisn - 1))/b return x -def random_vector_on_spherical_cap (axis, maximum_planar_angle): +def random_vector_on_spherical_cap(axis, maximum_planar_angle): dim = axis.size maximum_solid_angle_fraction = planar_angle2solid_angle_fraction(maximum_planar_angle, dim) solid_angle_fraction = maximum_solid_angle_fraction*random() |