Kepler Solver

This module solves for the orbit of the planet given Keplerian parameters.

orbitize.kepler.calc_orbit(epochs, sma, ecc, inc, aop, pan, tau, plx, mtot, mass_for_Kamp=None, tau_ref_epoch=58849, tolerance=1e-09, max_iter=100, use_c=True, use_gpu=False)[source]

Returns the separation and radial velocity of the body given array of orbital parameters (size n_orbs) at given epochs (array of size n_dates)

Based on orbit solvers from James Graham and Rob De Rosa. Adapted by Jason Wang and Henry Ngo.

  • epochs (np.array) – MJD times for which we want the positions of the planet

  • sma (np.array) – semi-major axis of orbit [au]

  • ecc (np.array) – eccentricity of the orbit [0,1]

  • inc (np.array) – inclination [radians]

  • aop (np.array) – argument of periastron [radians]

  • pan (np.array) – longitude of the ascending node [radians]

  • tau (np.array) – epoch of periastron passage in fraction of orbital period past MJD=0 [0,1]

  • plx (np.array) – parallax [mas]

  • mtot (np.array) – total mass of the two-body orbit (M_* + M_planet) [Solar masses]

  • mass_for_Kamp (np.array, optional) – mass of the body that causes the RV signal. For example, if you want to return the stellar RV, this is the planet mass. If you want to return the planetary RV, this is the stellar mass. [Solar masses]. For planet mass ~ 0, mass_for_Kamp ~ M_tot, and function returns planetary RV (default).

  • tau_ref_epoch (float, optional) – reference date that tau is defined with respect to (i.e., tau=0)

  • tolerance (float, optional) – absolute tolerance of iterative computation. Defaults to 1e-9.

  • max_iter (int, optional) – maximum number of iterations before switching. Defaults to 100.

  • use_c (bool, optional) – Use the C solver if configured. Defaults to True

  • use_gpu (bool, optional) – Use the GPU solver if configured. Defaults to False


raoff (np.array): array-like (n_dates x n_orbs) of RA offsets between the bodies (origin is at the other body) [mas]

deoff (np.array): array-like (n_dates x n_orbs) of Dec offsets between the bodies [mas]

vz (np.array): array-like (n_dates x n_orbs) of radial velocity of one of the bodies

(see mass_for_Kamp description) [km/s]

Return type


Written: Jason Wang, Henry Ngo, 2018

orbitize.kepler.tau_to_manom(date, sma, mtot, tau, tau_ref_epoch)[source]

Gets the mean anomlay

  • date (float or np.array) – MJD

  • sma (float) – semi major axis (AU)

  • mtot (float) – total mass (M_sun)

  • tau (float) – epoch of periastron, in units of the orbital period

  • tau_ref_epoch (float) – reference epoch for tau


mean anomaly on that date [0, 2pi)

Return type

float or np.array