healpy.rotator.dir2vec(theta, phi=None, lonlat=False)

Transform a direction theta,phi to a unit vector.


theta : float, scalar or array-like

The angle theta (scalar or shape (N,)) or both angles (scalar or shape (2, N)) if phi is not given.

phi : float, scalar or array-like, optionnal

The angle phi (scalar or shape (N,)).

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 : array

The vector(s) corresponding to given angles, shape is (3,) or (3, N).

See also

vec2dir(), pixelfunc.ang2vec(), pixelfunc.vec2ang()