In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from transitfit import LightCurve, KeplerLightCurve, TransitModel
In [6]:
lc = KeplerLightCurve(1422)
In [7]:
model = TransitModel(lc)
In [8]:
params = lc.default_params #super-simple guesses for parameters
fig = model.plot_planets(params); #not bad!
In [ ]:
model.fit_multinest(n_live_points = 400, )
In [ ]:
In [ ]:
In [ ]:
In [9]:
model.lnpost(params)
Out[9]:
In [6]:
%timeit f = model(params) #evaluates ln(posterior)
In [7]:
#fit = model.fit_leastsq(params, options={'disp':True})
#fig = model.plot_planets(lc.default_params, color='b');
#fig = model.plot_planets(model._bestfit, color='r', fig=fig);
Now, let's do a test emcee
run (this many iterations takes about 3 minutes):
In [8]:
import time
start = time.time()
model.fit_emcee(nburn=5, niter=10);
stop = time.time()
print 'emcee fit took {:.1f} minutes.'.format((stop-start)/60)
In [9]:
model.save_hdf('test_model.h5')
In [10]:
model = TransitModel.load_hdf('test_model.h5')
In [11]:
model.samples.head()
Out[11]:
In [12]:
model.samples.std()
Out[12]:
In [13]:
fig1 = model.triangle(i=0); # for first planet
In [14]:
fig2 = model.triangle(i=1)
In [ ]: