# import everything we need from kafe
from kafe import *
# additionally, import the two model functions we want to fit:
from kafe.function_library import linear_2par, exp_2par
############
# Load the Dataset from the file
my_dataset = Dataset(input_file='dataset.dat',
title="Example Dataset")
### Create the Fits
my_fits = [ Fit(my_dataset, exp_2par),
Fit(my_dataset, linear_2par) ]
### Do the Fits
for fit in my_fits:
fit.do_fit()
### Create the plots, save and show output
my_plot = Plot(my_fits[0], my_fits[1])
# show data only once (it's the same data
my_plot.plot_all(show_data_for=0) )
my_plot.save('plot.pdf')
my_plot.show()
linear_2par
chi2prob 0.052
HYPTEST accepted (CL 5%)
exp_2par
chi2prob 0.96
HYPTEST accepted (CL 5%)