sph_to_cart#

caput.astro.coordinates.spherical.sph_to_cart(sph_coords: numpy.typing.ArrayLike[numpy.integer | numpy.floating]) numpy.ndarray[numpy.float64][source]#

Convert a vector in spherical polar coordinates to Cartesian coordinates.

This routine is OpenMP-parallel.

Parameters:
sph_coordsarray_like

A vector (or array) of spherical polar coordinates. Values should be packed as [r, theta, phi] along the last axis. Alternatively they can be packed as [theta, phi] in which case r is assumed to be one.

Returns:
cart_vectorarray_like

Array of equivalent vectors in cartesian coordinartes.