python scipy put more weight to a set value in curve fit

Solutions on MaxInterview for python scipy put more weight to a set value in curve fit by the best coders in the world

showing results for - "python scipy put more weight to a set value in curve fit"
Julia
08 Oct 2020
1from scipy.optimize import curve_fit
2
3# simply add an uncertainties to each sample;
4# very small uncertainty mean almost as true value, so will be taken as reference point;
5uncertainties = numpy.array([1.0E-10, 1.0E-10, 1.0E-10, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,1.0, 1.0])
6
7# Use uncertainties with absolute_sigma as True;
8fittedParameters, pcov = curve_fit(func, xData, yData, sigma=uncertainties, absolute_sigma=True)