Ephemeris Processors#
The JAX-compatible functions for manipulating JPL DE ephemeris data.
- class jorbit.ephemeris.ephemeris_processors.EphemerisPostProcessor(ephs, postprocessing_func)[source]#
Bases:
objectA pytree-compatible class for post-processing multiple ephemeris calculations.
Useful when one ephemeris (e.g. the asteroids) provides coordinates based on the positions of an object in another (e.g. the sun).
- Parameters:
ephs (list)
postprocessing_func (collections.abc.Callable)
- log_gms#
Concatenated array of natural log of gravitational parameters (GM) from all ephemeris processors.
- Type:
jnp.ndarray
- classmethod tree_unflatten(aux_data, children)[source]#
Reconstructs a class instance from flattened data.
- Parameters:
aux_data (
None) – Auxiliary data (unused).children (
tuple) – Tuple containing ephemeris processors and post-processing function.
- Returns:
A new instance of the class.
- Return type:
- state(tdb)[source]#
Computes combined and post-processed state vectors for all bodies.
This method: 1. Initializes empty arrays for position and velocity 2. Computes states for each ephemeris processor 3. Concatenates the results vertically 4. Applies the post-processing function to the combined states
- Parameters:
tdb (
float) – Requested time in Julian days TDB (Barycentric Dynamical Time).- Returns:
The post-processed state vectors. The exact structure depends on the post-processing function, but typically includes - jnp.ndarray: Processed position vectors, shape (n_total_bodies, 3) - jnp.ndarray: Processed velocity vectors, shape (n_total_bodies, 3)
- Return type:
tuple
- tree_flatten()[source]#
Flattens the class instance for JAX pytree compatibility.
- Returns:
- A tuple of (children, auxiliary_data) where children contains
the ephemeris processors and post-processing function, and auxiliary_data is None.
- Return type:
tuple- Parameters:
self (EphemerisPostProcessor)
- class jorbit.ephemeris.ephemeris_processors.EphemerisProcessor(init, intlen, coeffs, log_gms)[source]#
Bases:
objectA pytree-compatible class for processing JPL DE ephemeris data.
This class provides functionality to evaluate Chebyshev polynomials for computing planetary positions and velocities from JPL Development Ephemerides (DE) data. It is compatible with JAX’s pytree system for automatic differentiation and parallelization.
- Parameters:
init (jax.Array)
intlen (jax.Array)
coeffs (jax.Array)
log_gms (jax.Array)
- classmethod tree_unflatten(aux_data, children)[source]#
Reconstructs a class instance from flattened data.
- Parameters:
aux_data (
None) – Auxiliary data (unused).children (
tuple) – Tuple of arrays to reconstruct the instance.
- Returns:
A new instance of the class.
- Return type:
- eval_cheby(coefficients, x)[source]#
Evaluates a Chebyshev polynomial using Clenshaw’s algorithm.
Implements Clenshaw’s recurrence formula for evaluating Chebyshev polynomials in a numerically stable way.
- Parameters:
coefficients (
Array) – Chebyshev polynomial coefficients.x (
float) – Input value in the domain [-1, 1].
- Returns:
A tuple containing (jnp.ndarray, The evaluated polynomial value; jnp.ndarray, Intermediate values used for velocity computation).
- Return type:
tuple
- state(tdb)[source]#
Computes positions and velocities for all bodies in the ephemeris at a given time.
- Parameters:
tdb (
float) – Requested time in Julian days TDB (Barycentric Dynamical Time).- Returns:
A tuple of jnp.ndarrays, first positions in AU, then velocities in AU/day.
- Return type:
tuple
- tree_flatten()[source]#
Flattens the class instance for JAX pytree compatibility.
- Returns:
- A tuple of (children, auxiliary_data) where children contains
the arrays to be transformed and auxiliary_data is None.
- Return type:
tuple- Parameters:
self (EphemerisProcessor)