healpy.pixelfunc.ang2vec(theta, phi, lonlat=False)

ang2vec : convert angles to 3D position vector


theta : float, scalar or arry-like

colatitude in radians measured southward from north pole (in [0,pi]).

phi : float, scalar or array-like

longitude in radians measured eastward (in [0, 2*pi]).

lonlat : bool

If True, input angles are assumed to be longitude and latitude in degree, otherwise, they are co-latitude and longitude in radians.


vec : float, array

if theta and phi are vectors, the result is a 2D array with a vector per row otherwise, it is a 1D array of shape (3,)

See also

vec2ang, rotator.dir2vec, rotator.vec2dir