コード例 #1
0
ファイル: mcmc.py プロジェクト: adadams/Eccentric-Atmospheres
print('{0} loaded as planet to model.'.format(planet.name))

# ##### Import the instrumental response data (currently for the Spitzer IRAC bands) and the routine to convert surface temperatures to observed planet-star flux ratios in a given band.

from data.bandpass.spitzer_IRAC import spitzer_IRAC as instrument
from data.bandpass.response import light_curve

# ##### Import the likelihood calculation routine.

from stats.gaussian import log_likelihood
from stats.metropolis import MCMC

# ##### Specify the spatial and time resolution for the calculations, including the number of orbits to run.

planet.set_resolution(longitude_resolution = 18,
                      latitude_resolution = 8,
                      time_resolution = 200,
                      num_orbits = 5)

# ##### A wrapper function using the thermal model and light curve routines to start with a set of specified parameter values and return a light curve. This function will be passed to the statistical likelihood function. (Note: if modeling a planet with expected tidal distortion, consider setting "use_tidal_distortion" to True.)

def generate_model(parameters, spectral_array):
    temperature_map = thermal_model.temperatures(planet=planet, parameters=parameters)
    model = light_curve(planet, temperature_map, spectral_array, parameters=parameters, use_tidal_distortion=False)
    return {'temp': temperature_map, 'model': model}

# ### MCMC LIKELIHOOD SEARCH
# ##### First define a (log) prior function that unpacks a set of parameters.

def mcmc_prior(parameters):
    p, r, T, a = parameters
    lnp = N.where(p>10*U.hr/planet.pseudosynchronous_period(), 0, -N.inf)
コード例 #2
0
from data.planet.HD209458b import HD209458b as exoplanet

# ##### Import the instrumental response data (currently for the Spitzer IRAC bands) and the routine to convert surface temperatures to observed planet-star flux ratios in a given band.

from data.bandpass.spitzer_IRAC import spitzer_IRAC as instrument
from data.bandpass.response import light_curve

# ##### Import the likelihood calculation routine.

from stats.gaussian import log_likelihood

# ##### Specify the spatial and time resolution for the calculations, including the number of orbits to run.

planet.set_resolution(longitude_resolution=72,
                      latitude_resolution=36,
                      time_resolution=200,
                      num_orbits=5)

# ##### Specify ranges to be used for the grid in parameter space to be sampled. Make sure that the rotation period is the first parameter. For the blackbody model one also specifies the radiative timescale at 1000 K, the "nightside" (baseline) temperature of the planet, and the global Bond albedo.

prot = N.linspace(0.1, 2.5, num=50) * planet.pseudosynchronous_period()
t1000 = N.linspace(2, 100, num=50)
#t1000[0] += 0.001
Tn = N.linspace(1145.93, 2000, num=1) * U.K
albedo = N.linspace(0.3829, 1.0, num=1)

parameters = [prot, t1000 * U.hr, Tn, albedo]

#Get a list of the search lengths along each parameter dimension, as well as the axis with the greatest number of elements and the total number of search elements.
search_dims = [len(l) for l in parameters]
max_axis = N.argmax(search_dims)