Spherical/Cartesian Coordinate Transformations

einsteinpy.utils.coord_transforms.CartesianToSpherical_pos(pos_vec)

Function to convert cartesian to spherical coordinates

Parameters

pos_vec (array) – 3-length numpy array having x,y,z coordinates in SI units(m)

Returns

3-length numpy array with r, theta, phi (m, rad, rad)

Return type

array

einsteinpy.utils.coord_transforms.CartesianToSpherical_vel(pos_vec, vel_vec)

Function to convert velocities in cartesian coordinates to velocities in spherical coordinates

Parameters
  • pos_vec (array) – 3-length numpy array having x,y,z coordinates in SI units(m)

  • vel_vec (array) – 3-length numpy array having vx, vy, vz in SI units(m/s)

Returns

3-length numpy array with V_r, V_theta, V_phi (m/s, rad/s, rad/s)

Return type

array

einsteinpy.utils.coord_transforms.SphericalToCartesian_pos(pos_vec)

Function to convert spherical coordinates

Parameters

pos_vec (array) – 3-length numpy array having r, theta, phi coordinates in SI units(m, rad, rad)

Returns

3-length numpy array with x, y, z in m.

Return type

array

einsteinpy.utils.coord_transforms.SphericalToCartesian_vel(pos_vec, vel_vec)

Function to convert velocities in spherical coordinates to velocities in cartesian coordinates

Parameters
  • pos_vec (array) – 3-length numpy array having r, theta, phi coordinates in SI units(m, rad, rad)

  • vel_vec (array) – 3-length numpy array with V_r, V_theta, V_phi (m/s, rad/s, rad/s)

Returns

3-length numpy array having vx, vy, vz in SI units(m/s)

Return type

array

einsteinpy.utils.coord_transforms.C2S_units(pos_vec, vel_vec)

Function to convert Cartesian to Spherical Coordinates along with handling units

Parameters
  • pos_vec (list) – list of 3 position coordinates along with appropriate units [x, y, z] (u.m, u.m, u.m)

  • vel_vec (list) – list of 3 velocity coordinates along with appropriate units [vx, vy, vz] (u.m/u.s, u.m/u.s, u.m/u.s)

Returns

consisting of 2 lists ([r, theta, phi], [vr, vtheta, vphi]) in units ([u.m, u.rad, u.rad],[u.m/u.s, u.rad/u.s, u.rad/u.s])

Return type

tuple

einsteinpy.utils.coord_transforms.S2C_units(pos_vec, vel_vec)

Function to convert Spherical to Cartesian Coordinates along with handling units

Parameters
  • pos_vec (list) – list of 3 position coordinates along with appropriate units [r, theta, phi] (u.m, u.rad, u.rad)

  • vel_vec (list) – list of 3 velocity coordinates along with appropriate units [vr, vtheta, vphi] (u.m/u.s, u.rad/u.s, u.rad/u.s)

Returns

consisting of 2 lists ([x, y, z], [vx, vy, vz]) in units ([u.m, u.m, u.m],[u.m/u.s, u.m/u.s, u.m/u.s])

Return type

tuple

einsteinpy.utils.coord_transforms.S2C_8dim(vec)

Function to convert spherical 8-length numpy array coordinates to cartesian

Parameters

vec (array) – Array of shape (n,8) in the form [t,r,theta,phi,vt,vr,vtheta,vphi] in SI units.

Returns

Array of shape (n,8) in the form [t,x,y,z,vt,vx,vy,vz] in SI units

Return type

array