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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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)