diff options
author | Aaron LI <aly@aaronly.me> | 2017-07-19 21:12:50 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-07-19 21:12:50 +0800 |
commit | 7743b0d9cc4a97c26f882a1d7ca3f61533922675 (patch) | |
tree | d7dd7814a9b065bb6ef49f8d22ea9ecd8342f19b /fg21sim/utils | |
parent | 69d7cb772beb540d4f586d96259a366aa2fa9782 (diff) | |
download | fg21sim-7743b0d9cc4a97c26f882a1d7ca3f61533922675.tar.bz2 |
Small updates to comments and configuration descriptions
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/utils')
-rw-r--r-- | fg21sim/utils/random.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fg21sim/utils/random.py b/fg21sim/utils/random.py index 6d835f8..d546f34 100644 --- a/fg21sim/utils/random.py +++ b/fg21sim/utils/random.py @@ -1,15 +1,16 @@ -# Copyright (c) 2016 Weitian LI <liweitianux@live.com> +# Copyright (c) 2016-2017 Weitian LI <weitian@aaronly.me> # MIT license """ -Custom utilities of random number generations. +Random number and/or points generations. """ import numpy as np def spherical_uniform(n=1): - """Uniformly pick random points on the surface of a unit sphere. + """ + Uniformly pick random points on the surface of an unit sphere. The algorithm is described in [SpherePointPicking]_. Parameters @@ -20,11 +21,13 @@ def spherical_uniform(n=1): Returns ------- theta : float, or 1D `~numpy.ndarray` - The polar angles, θ ∈ [0, π]. (unit: rad) + The polar angles, θ ∈ [0, π]. If ``n > 1``, then returns a 1D array containing all the generated - coordinates. (unit: rad) + coordinates. + Unit: [rad] phi : float, or 1D `~numpy.ndarray` The azimuthal angles, φ ∈ [0, 2π). + Unit: [rad] NOTE ---- @@ -35,9 +38,9 @@ def spherical_uniform(n=1): used by mathematicians. The following relation can be used to convert the generated (theta, phi) - to the Galactic longitude and latitude convention: - glon = np.rad2deg(phi) - glat = 90.0 - np.rad2deg(theta) + to the Galactic/equatorial longitude and latitude convention: + lon = np.rad2deg(phi) + lat = 90.0 - np.rad2deg(theta) References ---------- |