Skip to content

Instantly share code, notes, and snippets.

@hersfeldtn
Created May 3, 2023 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hersfeldtn/61970318447f86fcded40a73b0e26501 to your computer and use it in GitHub Desktop.
Save hersfeldtn/61970318447f86fcded40a73b0e26501 to your computer and use it in GitHub Desktop.
from planetsynth import PlanetSynth
import numpy as np
import math as ma
pls = PlanetSynth()
M = float(input('''
Mass of planet in Jupiter masses
Min: 0.1
Max: 30
(effects of deuterium burning for >13 Mj not modeled)
Input: '''))
if M > 5:
maxZ = 0.04
elif M > 3:
maxZ = 0.2
elif M > 1:
maxZ = 0.5
else:
maxZ = 0.8
Z = float(input(f'''
Bulk planet metallicity; portion of mass composed of elements heavier than helium
For your mass:
Min: 0
Max: {maxZ}
Input: '''))
maxZe = min(0.1, Z)
Ze = float(input(f'''
Atmospheric metallicity: portion of atmospheric mass composed of elements heavier than helium
For your bulk metallicity:
Min: 0
Max: {maxZe}
Input: '''))
logF = ma.log10(float(input('''
Stellar flux in Watts/meter^2
Min: 0.01 (effectively 0)
Max: 1000000 (1e6)
(assumed to remain constant)
Input: '''))*250)
#converts to log of ergs/s/cm^2
logt = ma.log10(float(input('''
Age of planet in billions of years
Min: 0.01
Max: 10
Input: '''))*1e9)
#converts to log of years
params = [M, Z, Ze, logF]
print('')
print('working...')
res = pls.predict(logt, params)
print(f'''
Results:
Radius (Earth radii):
{res[0]*10.973}
Luminosity (relative to Sun):
{10**res[1]}
Effective temperature (Kelvin):
{res[2]}
Surface gravity (Earth g):
{(10**res[3])/981}
''')
a = input('press enter to exit ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment