bfieldtools.sphtools.cartvec2sph

bfieldtools.sphtools.cartvec2sph(sp, vec)

Transforms cartesian vector to spherical coordinates.

Parameters
sp: Nx3 array

spherical coordinates [r, theta, phi]

vec: Nx3 array

vector in cartesian coordinates [e_x, e_y, e_z]

Returns
svec: Nx3 array

vector in spherical coordinates [e_r, e_theta, e_phi]