xy2polar#

ktch.harmonic.xy2polar(xy: npt.NDArray[np.float64], *, centered: bool = True) npt.NDArray[np.float64][source]#

Convert Cartesian coordinates to polar coordinates on the unit disk.

Parameters:
xyndarray of shape (N, 2)

Cartesian coordinates. If centered=True (default), assumed in [-1, 1] x [-1, 1]. If centered=False, assumed in [0, 1] x [0, 1].

centeredbool, default=True

Whether the input is already centered at the origin.

Returns:
ndarray of shape (N, 2)

Polar coordinates [r, theta] where r is in [0, 1] and theta is in [0, 2*pi).