Exemple #1
0
import numpy as np
import pylab
from scipy.stats.distributions import gamma, norm as norm_dist

import Infer
from MyFuncs import Transit_aRs

#light curve parameters
lc_pars = [.0, 2.5, 11., .1, 0.6, 0.2, 0.3, 1., 0.]
gp = [.0003, 2.5, 10., .104, 0.6, 0.2, 0.3, 1., 0.]
hp = [0.0004, 0.1, 0.0001]

#create the data set (ie training data)
t = np.linspace(-0.1, 0.1, 300)
t_pred = np.linspace(-0.12, 0.12, 1000)
flux = Transit_aRs(lc_pars,
                   t) + 0.0005 * np.sin(2 * np.pi * 40 * t) + np.random.normal(
                       0, hp[-1], t.size)

#guess parameter values and guess uncertainties
guess_pars = hp + gp
err_pars = np.array([0.0004, 0.1, 0.0001] +
                    [0.00001, 0, 0.2, 0.0003, 0.02, 0.0, 0.0, 0.001, 0.])

#construct the GP
MyGP = Infer.GP(flux,
                np.matrix([
                    t,
                ]).T,
                p=guess_pars,
                mf=Transit_aRs,
                mf_args=t,
Exemple #2
0
import numpy as np
import pylab
import os

import Infer
from MyFuncs import Transit_aRs
from MyFuncs import LogLikelihood_iid_mf

#light curve parameters
lc_pars = [.0, 2.5, 11., .1, 0.6, 0.2, 0.3, 1., 0.]
wn = 0.0003

#create the data set (ie training data)
time = np.arange(-0.1, 0.1, 0.001)
flux = Transit_aRs(lc_pars, time) + np.random.normal(0, wn, time.size)

#guess parameter values and guess uncertainties
guess_pars = lc_pars + [wn]
err_pars = [0.00001, 0, 0.2, 0.0003, 0.02, 0.0, 0.0, 0.001, 0.0001, 0.0001]

#plot the light curve + guess function
pylab.figure(1)
pylab.errorbar(time, flux, yerr=wn, fmt='.')
pylab.plot(time, Transit_aRs(guess_pars[:-1], time), 'r--')

#define MCMC parameters
chain_len = 20000
conv = 10000
thin = 10
no_ch = 2
Exemple #3
0
import sys
import time

import pylab

import Infer
from MyFuncs import Transit_aRs

#light curve parameters
lc_pars = [.0,2.5,11.,.1,0.6,0.2,0.3,1.,0.]
hp = [0.0003,0.01,0.0003]

#create the data set (ie training data)
t = np.linspace(-0.1,0.1,300)
t_pred = np.linspace(-0.12,0.12,1000)
flux = Transit_aRs(lc_pars,t) + np.random.normal(0,hp[-1],t.size)

#guess parameter values and guess uncertainties
guess_pars = hp + lc_pars
err_pars = np.array([0.00001,1,0.0001] + [0.00001,0,0.2,0.0003,0.02,0.0,0.0,0.001,0.0001])

X = np.matrix([t,]).T
X_pred = np.matrix([t_pred,]).T

MyGP = Infer.GP(flux,X,p=guess_pars,mf=Transit_aRs,mf_args=t,n_hp=3)

#make plot of the function
pylab.figure(1)
pylab.plot(MyGP.mf_args,MyGP.t,'k.')
pylab.plot(MyGP.mf_args,MyGP.mf(lc_pars,MyGP.mf_args),'g-')