pymgp.satorb.vec2orb#
- pymgp.satorb.vec2orb(svec, GM=398600441800000.0)[source]#
Convert inertial state vector into Keplerian elements.
This function converts an array with 6-element inertial state vector(s), with cartesian position and velocity [X, Y, Z, Xdot, Ydot, Zdot], into an array with the 6 Keplerian elements.
- Parameters:
- svecarray_like with shape (…,6)
Array with 6-element inertial state vector svec with Cartesian position and velocity [X, Y, Z, Xdot, Ydot, Zdot] in an ECI frame. Units are meter and meter/sec
- GMfloat, optional
Value of GM. Default for GM [meter**3/sec**2] is the IERS 1996 standard value for the Earth (GM=3986004418e5)
- Returns:
- orbndarray with shape (…,6) similar to svec
Array with the 6 Keplerian elements [ Semi-major axis (meters), Eccentricity (unity), Inclination (radians), Right ascension of the ascending node (radians), Argument of the pericenter (radians), True anomaly (radians) ]. Units are meters or radians.
Notes
The computations do not do special hanling of circular or equatorial orbits. This is possible because atan2(0,0)=0 is defined in numpy, however, some pairs of angles will actually be singular.
Examples
>>> vec2orb([-5767701.7786, -3097382.0132, 2737195.4374, 3001.4240, -6762.1059, -1280.2560]) array([7.12138217e+06, 4.31759805e-03, 4.35789999e-01, 1.60777001e+00, 1.39024880e+00, 5.98791190e-01])
>>> # X Y Z Vx Vy Vz >>> svec = [[-5767701.7786, -3097382.0132, 2737195.4374, 3001.4240, -6762.1059, -1280.2560], ... [ -625224.3608, -7162713.9833, 16233.9739, -1131.8951, 116.3879, 7358.7436], ... [-2301220.9378, 6666917.3737, 968353.5303, -6610.7556, -1833.8971, -2992.6557]] >>> vec2orb(svec) array([[7.12138217e+06, 4.31759805e-03, 4.35789999e-01, 1.60777001e+00, 1.39024880e+00, 5.98791190e-01], [7.19093100e+06, 1.80794915e-04, 1.72419000e+00, 4.62567000e+00, 7.39124272e-01, 5.54634573e+00], [7.12297382e+06, 1.74770022e-03, 4.36259992e-01, 5.34368001e+00, 1.56062623e+00, 1.25322376e+00]]) >>> vec2orb(svec).shape (3, 6)
>>> vec2orb([svec, svec]).shape (2, 3, 6)