In [1]:
%matplotlib inline
from pylab import*
import numpy as np
In [2]:
from cvfit import fitting
from cvfit.fitting import SingleFitSession
from cvfit.fitting import MultipleFitSession
In [3]:
datasets, fname = fitting.load_data(example=True)
print('File {0} loaded'.format(fname))
print('{0:d} sets found.'.format(len(datasets)))
#sets = fitting.set_weights(sets)
for i in range(len(datasets)):
print ('\nSet #{0:d}:'.format(i+1))
print (datasets[i])
In [4]:
from cvfit.equations import Hill
eq = Hill('Hill')
fs = SingleFitSession(datasets[0], eq)
In [5]:
fs.fit()
fs.calculate_errors()
print(fs.string_estimates())
print(fs.string_liklimits())
In [6]:
fits = MultipleFitSession()
for each in datasets:
eq = Hill('Hill')
fs = SingleFitSession(each, eq)
fits.add(fs)
In [7]:
for fs in fits.list:
print("\n\tSTART FITTING ===============")
fs.fit()
fs.calculate_errors()
print(fs.string_estimates())
print(fs.string_liklimits())
print("\n\tFITTING FINISHED ============")
print ("\nFINISHED FITTING ALL SETS")
In [8]:
fplots = fitsessions.prepare_fplot('fit')
fig = plots.cvfit_plot(datasets, fig=None,
fplotsets=fplots, fplotline='b-',
logX=True, logY=False, legend=True)
In [ ]: