xyz2spherical#

ktch.harmonic.xyz2spherical(xyz: npt.NDArray[np.float64]) npt.NDArray[np.float64][source]#

Convert Cartesian coordinates to spherical coordinates.

Parameters:
xyzndarray of shape (n, 3)

Cartesian coordinates (x, y, z). Points are assumed to lie on or near the unit sphere.

Returns:
theta_phindarray of shape (n, 2)

Spherical coordinates [theta, phi] where theta is the polar angle (colatitude, 0 to pi) and phi is the azimuthal angle (-pi to pi).