xy_d2.axis_labels = ['x', 'y(2) & f(x)'] # 3. create the Fit objects xyFit1 = Fit(xy_d1, model1) xyFit2 = Fit(xy_d2, model2) # set meaningful names for model xyFit1.model_label = 'Lineares Modell' xyFit2.model_label = 'Lineares Modell' # add the parameter constraints xyFit1.add_parameter_constraint(name='g1', value=c1, uncertainty=ec1) xyFit2.add_parameter_constraint(name='g2', value=c2, uncertainty=ec2) # combine the two fit objects to form a MultiFit multiFit = MultiFit(fit_list=[xyFit1, xyFit2]) # 4. perform the fit multiFit.do_fit() # 5. report fit results multiFit.report() # 6. create and draw plots multiPlot = Plot(multiFit) ##multiPlot = Plot(multiFit, separate_figures=True) multiPlot.plot(figsize=(13., 7.)) # 7. show or save plots # ##for i, fig in enumerate(multiPlot.figures): ## fig.savefig("MultiFit-"+str(i)+".pdf") plt.show()
multi_fit.add_error(axis='x', err_val=sigU, fits='all') # (Optional): assign names for models and parameters multi_fit.assign_parameter_latex_names(x='U', p2='p_2', p1='p_1', p0='p_0', R0='R_0', alph=r'\alpha_\mathrm{T}') multi_fit.assign_model_function_expression('{1}*{x}^2 + {2}*{x} + {3}', fit_index=0) multi_fit.assign_model_function_latex_expression( r'{1}\,{x}^2 + {2}\,{x} + {3}', fit_index=0) multi_fit.assign_model_function_expression( '{x} / ({1} * (1 + ({3}*{x}^2 + {4}*{x} + {5}) * {2}))', fit_index=1) multi_fit.assign_model_function_latex_expression( r'\frac{{{x}}}{{{1} \cdot (1 + ({3}{x}^2 + {4}{x} + {5}) \cdot {2})}}', fit_index=1) # Step 4: do the fit multi_fit.do_fit() # (Optional): print the results multi_fit.report() # (Optional): plot the results plot = Plot(multi_fit, separate_figures=True) plot.plot() plt.show()