bfieldtools.sphtools.cartesian2spherical

bfieldtools.sphtools.cartesian2spherical(p, zaxis_approx=True)

Maps cartesian coordinates to spherical.

Parameters
p: Nx3 array

cartesian coordinates

zaxis_approx: Boolean (True)

If True, apply regularization that avoids singularity on z-axis

Returns
sp: Nx3 array

spherical coordinates [r, theta, phi]