Created
May 10, 2017 19:16
-
-
Save j-faria/652d573c080e82bac689843dd1c2cf9c to your computer and use it in GitHub Desktop.
Calculate the mass and semi-major axis of a planet, from its orbital period, semi-amplitude and eccentricity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy.constants import G | |
import astropy.units as u | |
# we assume m_planet << m_star | |
def get_planet_mass(P, K, e, star_mass=1.0): | |
""" | |
P in days, K in m/s, star_mass in solar masses | |
output is planet mass in Jupiter masses | |
""" | |
m_mj = 4.919e-3 * star_mass**(2./3) * P**(1./3) * K * np.sqrt(1-e**2) | |
return m_mj | |
def get_planet_semimajor_axis(P, K, star_mass=1.0): | |
""" | |
P in days, K in m/s, star_mass in solar masses | |
output is semimajor axis (of planet orbit) in AU | |
""" | |
f = (G.to(u.AU**3 / (u.solMass * u.day**2))**(1./3)).value | |
a = f * star_mass**(1./3) * (P/(2*np.pi))**(2./3) | |
return a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment