From 7743b0d9cc4a97c26f882a1d7ca3f61533922675 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 19 Jul 2017 21:12:50 +0800 Subject: Small updates to comments and configuration descriptions Signed-off-by: Aaron LI --- fg21sim/utils/random.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'fg21sim/utils/random.py') 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 +# Copyright (c) 2016-2017 Weitian LI # 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 ---------- -- cgit v1.2.2