sorcha.ephemeris.orbit_conversion_utilities

Classes

halley_result

Functions

stumpff(x)

Computes the Stumpff function c_k(x) for k = 0, 1, 2, 3

root_function(s, mu, alpha, r0, r0dot, t)

Root function used in the Halley minimizer

halley_safe(x1, x2, mu, alpha, r0, r0dot, t[, xacc, maxit])

Applies the Halley root finding algorithm on the universal Kepler equation

universal_cartesian(mu, q, e, incl, longnode, argperi, ...)

Converts from a series of orbital elements into state vectors

principal_value(theta)

Computes the principal value of an angle

universal_cometary(mu, x, y, z, vx, vy, vz, epochMJD_TDB)

Converts from a state vectors into cometary orbital elements

universal_keplerian(mu, x, y, z, vx, vy, vz, epochMJD_TDB)

Converts from a state vectors into Keplerian orbital elements

Module Contents

class halley_result[source]

Bases: tuple

root[source]
iterations[source]
function_calls[source]
converged[source]
flag[source]
f[source]
fp[source]
fpp[source]
stumpff(x)[source]

Computes the Stumpff function c_k(x) for k = 0, 1, 2, 3

Parameters:

x (float) -- Argument of the Stumpff function

Returns:

  • d0 (float) -- c_0(x)

  • d1 (float) -- c_1(x)

  • d2 (float) -- c_2(x)

  • d3 (float) -- c_3(x)

root_function(s, mu, alpha, r0, r0dot, t)[source]

Root function used in the Halley minimizer Computes the zeroth, first, second, and third derivatives of the universal Kepler equation f

Parameters:
  • s (float) -- Eccentric anomaly

  • mu (float) -- Standard gravitational parameter GM

  • alpha (float) -- Total energy

  • r0 (float) -- Initial position

  • r0dot (float) -- Initial velocity

  • t (float) -- Time

Returns:

  • f (float) -- universal Kepler equation)

  • fp (float) -- (first derivative of f

  • fpp (float) -- second derivative of f

  • fppp (float) -- third derivative of f

halley_safe(x1, x2, mu, alpha, r0, r0dot, t, xacc=1e-14, maxit=100)[source]

Applies the Halley root finding algorithm on the universal Kepler equation

Parameters:
  • x1 (float) -- Previous guess used in minimization

  • x2 (float) -- Current guess for minimization

  • mu (float) -- Standard gravitational parameter GM

  • alpha (float) -- Total energy

  • r0 (float) -- Initial position

  • r0dot (float) -- Initial velocity

  • t (float) -- Time

  • xacc (float, default=1e-14) -- Accuracy in x before algorithm declares convergence

  • maxit (int, default=100) -- Maximum number of iterations

Returns:

  • boolean -- True if minimization converged, False otherwise

  • float -- Solution

  • float -- First derivative of solution

universal_cartesian(mu, q, e, incl, longnode, argperi, tp, epochMJD_TDB)[source]

Converts from a series of orbital elements into state vectors using the universal variable formulation

The output vector will be oriented in the same system as the positional angles (i, Omega, omega)

Note that mu, q, tp and epochMJD_TDB must have compatible units As an example, if q is in au and tp/epoch are in days, mu must be in (au^3)/days^2

Parameters:
  • mu (float) -- Standard gravitational parameter GM (see note above about units)

  • q (float) -- Perihelion (see note above about units)

  • e (float) -- Eccentricity

  • incl (float) -- Inclination (radians)

  • longnode (float) -- Longitude of ascending node (radians)

  • argperi (float) -- Argument of perihelion (radians)

  • tp (float) -- Time of perihelion passage in TDB scale (see note above about units)

  • epochMJD_TDB (float) -- Epoch (in TDB) when the elements are defined (see note above about units)

Returns:

  • float -- x coordinate

  • float -- y coordinate

  • float -- z coordinate

  • float -- x velocity

  • float -- y velocity

  • float -- z velocity

principal_value(theta)[source]

Computes the principal value of an angle

Parameters:

theta (float) -- Angle

Returns:

theta -- Principal value of angle

Return type:

float

universal_cometary(mu, x, y, z, vx, vy, vz, epochMJD_TDB)[source]

Converts from a state vectors into cometary orbital elements using the universal variable formulation

The input vector will determine the orientation of the positional angles (i, Omega, omega)

Note that mu and the state vectors must have compatible units As an example, if x is in au and vx are in au/days, mu must be in (au^3)/days^2

Parameters:
  • mu (float) -- Standard gravitational parameter GM (see note above about units)

  • x (float) -- x coordinate

  • y (float) -- y coordinate

  • z (float) -- z coordinate

  • vx (float) -- x velocity

  • vy (float) -- y velocity

  • vz (float) -- z velocity

  • (float) (epochMJD_TDB) -- Epoch (in TDB) when the elements are defined (see note above about units)

Returns:

  • q (float) -- Perihelion (see note above about units)

  • e (float) -- Eccentricity

  • incl (float) -- Inclination (radians)

  • longnode (float) -- Longitude of ascending node (radians)

  • argperi (float) -- Argument of perihelion (radians)

  • tp (float) -- Time of perihelion passage in TDB scale (see note above about units)

universal_keplerian(mu, x, y, z, vx, vy, vz, epochMJD_TDB)[source]

Converts from a state vectors into Keplerian orbital elements using the universal variable formulation

The input vector will determine the orientation of the positional angles (i, Omega, omega)

Note that mu and the state vectors must have compatible units As an example, if x is in au and vx are in au/days, mu must be in (au^3)/days^2

Parameters:
  • mu (float) -- Standard gravitational parameter GM (see note above about units)

  • x (float) -- x coordinate

  • y (float) -- y coordinate

  • z (float) -- z coordinate

  • vx (float) -- x velocity

  • vy (float) -- y velocity

  • vz (float) -- z velocity

  • (float) (epochMJD_TDB) -- Epoch (in TDB) when the elements are defined (see note above about units)

Returns:

  • a (float) -- Semi-major axis (see note above about units)

  • e (float) -- Eccentricity

  • inc (float) -- Inclination (radians)

  • longnode (float) -- Longitude of ascending node (radians)

  • argperi (float) -- Argument of perihelion (radians)

  • M (float) -- Mean anomaly (radians)