Skip to content

Instantly share code, notes, and snippets.

@texadactyl
Created May 16, 2019 16:19
Show Gist options
  • Save texadactyl/60b3a93edae2093d535fc66580028cfa to your computer and use it in GitHub Desktop.
Save texadactyl/60b3a93edae2093d535fc66580028cfa to your computer and use it in GitHub Desktop.
Python Program for Estimating the Habitable Zone
'''
Habitable Zone estimation
Reference: https://exoplanetarchive.ipac.caltech.edu/docs/poet_calculations.html
'''
import numpy as np
R_SUN = 696342.0 # km
T_SUN = 5788.0 # Kelvin
R_HD127688 = 0.732 * R_SUN # km
T_HD127688 = 4630.0 # Kelvin
def get_luminosity_ratio(arg_star_km, arg_star_temp):
'''
Given the radius and temperature of a star on the main sequence,
estimate & return the luminosity ratio (L-star / L-sun).
'''
return np.power(arg_star_km / R_SUN, 2) \
* np.power(arg_star_temp / T_SUN, 4)
def get_hz(arg_luminosity_ratio):
'''
Given the luminosity of a star on the main sequence,
estimate & return its habitable zone boundaries in AUs.
'''
sqrtratio = np.sqrt(arg_luminosity_ratio)
_r_inner = 0.75 * sqrtratio # innermost boundary
_r_outer = 1.77 * sqrtratio # outermost boundary
return _r_inner, _r_outer
L_RATIO = get_luminosity_ratio(R_HD127688, T_HD127688) # absolute luminosity
R_INNER, R_OUTER = get_hz(L_RATIO)
print("For the HD-127688 system, luminosity ratio={:.3f}, inner={:.3f} AU, outer={:.3f} AU"
.format(L_RATIO, R_INNER, R_OUTER))
print("The luminosity ratio is given as the luminosity of HD-127688 a divided by that of our Sun")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment