orbix.equations.orbit#
Common equations for orbital mechanics.
Attributes#
Functions#
|
Orbital period from semi-major axis and standard gravitational parameter. |
|
Orbital period from mean motion. |
|
Mean motion from semi-major axis and standard gravitational parameter. |
|
Semi-major axis from orbital period via Kepler's third law. |
|
Semi-amplitude of the radial velocity curve from base quantities. |
|
Semi-amplitude of the radial velocity curve from pre-calculated quantities. |
|
Mean anomaly at time t (can be vector) from epoch. |
|
Mean anomaly at time t (can be vector) from periapsis passage. |
|
Compute the A and B matrices for a given set of orbital elements. |
|
Compute the A and B matrices from the trig values of the orbital elements. |
|
Compute the Thiele-Innes constants from the orbital angles. |
|
Compute the Thiele-Innes constants from the orbital angles. |
|
Vector norm with a finite (zero) gradient at |
|
Convert state vectors (r, v) to Keplerian elements using JAX. |
Module Contents#
- orbix.equations.orbit.two_pi_G#
- orbix.equations.orbit.period_a(a, mu)[source]#
Orbital period from semi-major axis and standard gravitational parameter.
- Parameters:
a – Array Semi-major axis
mu – Array Standard gravitational parameter
- Returns:
- Array
Orbital period
- Return type:
T
- orbix.equations.orbit.period_n(n)[source]#
Orbital period from mean motion.
- Parameters:
n – Array Mean motion
- Returns:
- Array
Orbital period
- Return type:
T
- orbix.equations.orbit.mean_motion(a, mu)[source]#
Mean motion from semi-major axis and standard gravitational parameter.
- Parameters:
a – Array Semi-major axis
mu – Array Standard gravitational parameter
- Returns:
- Array
Mean motion
- Return type:
n
- orbix.equations.orbit.period_to_sma(T, Ms)[source]#
Semi-major axis from orbital period via Kepler’s third law.
- Parameters:
T – Orbital period (days). Scalar or array.
Ms – Stellar mass (kg). Scalar or array.
- Returns:
Semi-major axis (AU). Scalar or array.
- Return type:
a
- orbix.equations.orbit.semi_amplitude(T, Ms, Mp, e, i)[source]#
Semi-amplitude of the radial velocity curve from base quantities.
- Parameters:
T – Array Orbital period
Ms – Array Mass of the star
Mp – Array Mass of the planet
e – Array Eccentricity
i – Array Inclination
- Returns:
- Array
Semi-amplitude of the radial velocity curve
- Return type:
K
- orbix.equations.orbit.semi_amplitude_reduced(T, Ms, minimum_mass, sqrt_one_minus_e2)[source]#
Semi-amplitude of the radial velocity curve from pre-calculated quantities.
- Parameters:
T – Array Orbital period
Ms – Array Mass of the star
minimum_mass – Array Mass of the planet multiplied by sin(i)
sqrt_one_minus_e2 – Array Square root of (1 - eccentricity^2)
- Returns:
- Array
Semi-amplitude of the radial velocity curve
- Return type:
K
- orbix.equations.orbit.mean_anomaly_t0(t, n, M0, t0)[source]#
Mean anomaly at time t (can be vector) from epoch.
Requires that all units are consistent and does NOT clip the mean anomaly to the range [0, 2pi).
- Parameters:
t – Array Time
n – Array Mean motion
M0 – Array Mean anomaly at epoch
t0 – Array Epoch
- Returns:
- Array
Mean anomaly at time t
- Return type:
M
- orbix.equations.orbit.mean_anomaly_tp(t, n, tp)[source]#
Mean anomaly at time t (can be vector) from periapsis passage.
- Parameters:
t – Array Time
n – Array Mean motion
tp – Array Time of periapsis passage
- Returns:
- Array
Mean anomaly at time t
- Return type:
M
- orbix.equations.orbit.AB_matrices(a, e, i, W, w)[source]#
Compute the A and B matrices for a given set of orbital elements.
In keplertools Dmitry defines these as: “inertial frame components of perifocal frame unit vectors scaled by orbit semi-major and semi-minor axes.” and I wouldn’t dare disagree with him on this.
- Parameters:
a – Array Semi-major axis
e – Array Eccentricity
i – Array Inclination
W – Array Longitude of the ascending node
w – Array Argument of periapsis
- Returns:
- jnp.ndarray
A matrix
- B: jnp.ndarray
B matrix
- Return type:
A
- orbix.equations.orbit.AB_matrices_reduced(a, sqrt_one_minus_e2, sini, cosi, sinW, cosW, sinw, cosw)[source]#
Compute the A and B matrices from the trig values of the orbital elements.
- Parameters:
a – Semi-major axis
sqrt_one_minus_e2 – Square root of (1 - eccentricity^2)
sini – Sine of the inclination
cosi – Cosine of the inclination
sinW – Sine of the longitude of the ascending node
cosW – Cosine of the longitude of the ascending node
sinw – Sine of the argument of periapsis
cosw – Cosine of the argument of periapsis
- Returns:
- jnp.ndarray
A matrix
- B: jnp.ndarray
B matrix
- Return type:
A
- orbix.equations.orbit.thiele_innes_constants(W, i, w)[source]#
Compute the Thiele-Innes constants from the orbital angles.
- Parameters:
W – Longitude of the ascending node
i – Inclination
w – Argument of periapsis
- Returns:
A constant B: B constant F: F constant G: G constant
- Return type:
A
- orbix.equations.orbit.thiele_innes_constants_reduced(sinW, cosW, sinw, cosw, sinwcosi, coswcosi)[source]#
Compute the Thiele-Innes constants from the orbital angles.
- Parameters:
sinW – Sine of the longitude of the ascending node
cosW – Cosine of the longitude of the ascending node
sinw – Sine of the argument of periapsis
cosw – Cosine of the argument of periapsis
sinwcosi – Sine of the argument of periapsis times cosine of the inclination
coswcosi – Cosine of the argument of periapsis times cosine of the inclination
- Returns:
A constant B: B constant F: F constant G: G constant
- Return type:
A
- orbix.equations.orbit._TOL_E = 1e-09#
- orbix.equations.orbit._TOL_N = 1e-09#
- orbix.equations.orbit._ARC_EPS = 1e-07#
- orbix.equations.orbit._safe_norm(x)[source]#
Vector norm with a finite (zero) gradient at
x == 0.jnp.linalg.normhas a NaN gradient at exactly the zero vector (x / norm(x)is0 / 0there). This computes the same value but evaluates the norm on a nonzero stand-in wheneverxis zero, so the local derivative is finite; thejnp.wherethen zeroes the corresponding cotangent, giving a well-defined (zero) gradient.
- orbix.equations.orbit.state_vector_to_keplerian(r, v, mu)[source]#
Convert state vectors (r, v) to Keplerian elements using JAX.
Robust implementation handling edge cases (circular, equatorial, and non-bound orbits) using
jnp.wherefor JIT compatibility.Unit-agnostic:
r,v, andmumust be expressed in one consistent unit system (e.g. meters / m/s / m^3 s^-2, or the AU / day units used elsewhere in this library); the function does not enforce or convert any particular convention, andais returned in the same length unit asr.- Parameters:
r – Stellar-centric position vector
(3,).v – Stellar-centric velocity vector
(3,).mu – Gravitational parameter
G * M_total.
- Returns:
(a, e, i, W, w, M)– semi-major axis (same lengthunit as
r), eccentricity, inclination [rad], longitude of ascending node [rad], argument of periapsis [rad], mean anomaly [rad].
- Return type: