healpy.rotator.dir2vec

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

Transform a direction theta,phi to a unit vector.

Parameters
thetafloat, scalar or array-like

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

phifloat, scalar or array-like, optionnal

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

lonlatbool

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

Returns
vecarray

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

See also

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