jnkepler.keplerian package
Submodules
jnkepler.keplerian.jacobian module
- jnkepler.keplerian.jacobian.det_jkep2D_am(params)[source]
Analytic Jacobian determinant for the transformation (a, e, omega, M) → (x, z, vx, vz) in the 2D Kepler problem.
- Parameters:
params (dict) – Orbital-element parameters.
- Returns:
Analytic Jacobian determinant.
- Return type:
float
- jnkepler.keplerian.jacobian.det_jkep2D_pm(params)[source]
Analytic Jacobian determinant for the transformation (P, e, omega, M) → (x, z, vx, vz) in the 2D Kepler problem.
- Parameters:
params (dict) – Orbital-element parameters.
- Returns:
Analytic Jacobian determinant.
- Return type:
float
- jnkepler.keplerian.jacobian.det_jkep_am(params)[source]
Analytic Jacobian determinant for the transformation (a, e, i, Omega, omega, M) → (x, y, z, vx, vy, vz).
- Parameters:
params (dict) – Orbital-element parameters.
- Returns:
Analytic Jacobian determinant.
- Return type:
float
- jnkepler.keplerian.jacobian.det_jkep_atau(params)[source]
Analytic Jacobian determinant for the transformation (a, e, i, Omega, omega, tau) → (x, y, z, vx, vy, vz).
- Parameters:
params (dict) – Orbital-element parameters.
- Returns:
Analytic Jacobian determinant.
- Return type:
float
- jnkepler.keplerian.jacobian.det_jkep_pm(params)[source]
Analytic Jacobian determinant for the transformation (P, e, i, Omega, omega, M) → (x, y, z, vx, vy, vz).
- Parameters:
params (dict) – Orbital-element parameters.
- Returns:
Analytic Jacobian determinant.
- Return type:
float
- jnkepler.keplerian.jacobian.det_jkep_ptau(params)[source]
Analytic Jacobian determinant for the transformation (P, e, i, Omega, omega, tau) → (x, y, z, vx, vy, vz).
- Parameters:
params (dict) – Orbital-element parameters.
- Returns:
Analytic Jacobian determinant.
- Return type:
float
- jnkepler.keplerian.jacobian.slogdet_jkep2D_jax(params, keys)[source]
Compute the Jacobian determinant for the mapping from orbital elements to Cartesian state vectors in the 2D Kepler problem using JAX autodiff
- Parameters:
params (dict) – Dictionary of orbital-element parameters.
keys (list[str]) – Parameter names with respect to which the Jacobian is computed. Only these parameters are differentiated. Typical choices correspond to combinations such as (a, ecc, omega, M), (period, ecc, omega, M).
- Returns:
- (sign, log_abs_det) from jnp.linalg.slogdet, where the Jacobian
is taken with respect to the flattened state vector (x, v).
- Return type:
tuple
- jnkepler.keplerian.jacobian.slogdet_jkep_jax(params, keys)[source]
Compute the Jacobian determinant for the mapping from orbital elements to Cartesian state vectors in the 3D Kepler problem using JAX autodiff
- Parameters:
params (dict) – Dictionary of orbital-element parameters.
keys (list[str]) – Parameter names with respect to which the Jacobian is computed. Only these parameters are differentiated. Typical choices correspond to combinations such as (a, ecc, inc, lnode, omega, M), (a, ecc, inc, lnode, omega, tau), (period, ecc, inc, lnode, omega, M).
- Returns:
- (sign, log_abs_det) from jnp.linalg.slogdet, where the Jacobian
is taken with respect to the flattened state vector (x, v).
- Return type:
tuple
jnkepler.keplerian.orbit module
- jnkepler.keplerian.orbit.elements_to_xv(t, params)[source]
Convert orbital elements to Cartesian state vectors.
- Parameters:
t (array_like) – Times (days) at which positions and velocities are evaluated.
params (dict) –
- Dictionary containing per-orbit orbital elements:
period : orbital period (days)
ecc : eccentricity
inc : inclination (radian)
omega : argument of periastron (radian)
lnode : longitude of ascending node (radian)
tau : time of periastron passage (days)
mass : total mass (solar masses)
- Returns:
- Cartesian position and velocity vectors:
x : array of shape (T, N, 3) if multiple orbits, or (T, 3) if a single orbit. Units: AU.
v : array of shape (T, N, 3) or (T, 3). Units: AU/day.
- Return type:
dict
- jnkepler.keplerian.orbit.elements_to_xv_scaled(t, params)[source]
Convert orbital elements to state vectors scaled by semi-major axis a.
- Parameters:
t (array_like) – Times (days) at which positions and velocities are evaluated.
params (dict) –
- Dictionary containing per-orbit orbital elements:
period : orbital period (days)
ecc : eccentricity
inc : inclination (radian)
omega : argument of periastron (radian)
lnode : longitude of ascending node (radian)
tau : time of periastron passage (days)
- Returns:
- Cartesian position and velocity vectors divided by a:
x : array of shape (T, N, 3) or (T, 3). Dimensionless.
v : array of shape (T, N, 3) or (T, 3). Units: 1/day.
- Return type:
dict
- jnkepler.keplerian.orbit.radial_velocity_shape(t, params)[source]
Compute cos(omega+f) + e*cos(omega)
- Parameters:
t – times at which RVs are computed
porb – period
ecc – eccentricity
omega – argument of periastron
tau – time of periastron passage
- Returns:
radial velocities
- Return type:
array
- jnkepler.keplerian.orbit.radial_velocity_shape_multi(t, params)[source]
Vectorized over leading axis of each leaf in params_all (dict-of-arrays).
- jnkepler.keplerian.orbit.tic_to_tau(tic, period, ecc, omega)[source]
Compute time of periastron passage from time of inferior conjunction tic
- Parameters:
tic – time of inferior conjunction where omega + f = pi/2
period – orbital period
ecc – eccentricity
omega – argument of periastron
- Returns:
time of periastron passage
- Return type:
float
- jnkepler.keplerian.orbit.xv_to_elements(x, v, mass, t_ref=None)[source]
Convert Cartesian state vectors to orbital elements.
- Parameters:
x – array_like Cartesian position vector(s) in AU, shape (3,) or (N, 3).
v – array_like Cartesian velocity vector(s) in AU/day, shape (3,) or (N, 3).
mass – float or array_like Total mass (solar masses).
t_ref – float or array_like, optional Reference epoch (days). If provided, the time of periastron passage (tau) is computed as tau = t_ref - M/n.
- Returns:
- dict
- Orbital elements:
a : semi-major axis (AU)
period : orbital period (days)
ecc : eccentricity
inc : inclination (radian)
omega : argument of periastron (radian)
lnode : longitude of ascending node (radian)
M : mean anomaly at t_ref (radian)
tau : time of periastron passage (days), if t_ref is given
mass : total mass (solar masses)
Each value is a scalar if a single orbit is given, or a 1-D array of length N for multiple orbits.