Documentation

Then, refer to the source documentation for details on how to use each
class.

Basic usage

fromscipy_data_fittingimportData,Model,Fit,Plot# Load data from a CSV file.data=Data('linear')data.path='linear.csv'data.error=(0.5,None)# Create a linear model.model=Model('linear')model.add_symbols('t','v','x_0')t,v,x_0=model.get_symbols('t','v','x_0')model.expressions['line']=v*t+x_0# Create the fit using the data and model.fit=Fit('linear',data=data,model=model)fit.expression='line'fit.independent={'symbol':'t','name':'Time','units':'s'}fit.dependent={'name':'Distance','units':'m'}fit.parameters=[{'symbol':'v','guess':1,'units':'m/s'},{'symbol':'x_0','value':1,'units':'m'},]# Save the fit result to a json file.fit.to_json(fit.name+'.json',meta=fit.metadata)# Save a plot of the fit to an image file.plot=Plot(fit)plot.save(fit.name+'.svg')plot.close()