python Programming Glossary: popt
SciPy instead of GNU Octave http://stackoverflow.com/questions/12343271/scipy-instead-of-gnu-octave c np.sin x ... ynoisy y np.random.normal 0 0.2 size len x popt pcov scipy.optimize.curve_fit func x ynoisy popt array 3.00015527.. len x popt pcov scipy.optimize.curve_fit func x ynoisy popt array 3.00015527 4.99421236 2.03380468 plots with error bars.. 0.5 yerr abs np.random.normal 0.3 10.0 fitted_data func x popt # using the simplified non object oriented interface here #..
Getting standard errors on fitted parameters using the optimize.leastsq method in python http://stackoverflow.com/questions/14581358/getting-standard-errors-on-fitted-parameters-using-the-optimize-leastsq-method-i be multiplied by the residual variance ie. s_sq func popt args 2 .sum len ydata len p0 pcov pcov s_sq as in curve_fit.py...
Fitting a 3D array of data to a 1D function with numpy or scipy http://stackoverflow.com/questions/15094619/fitting-a-3d-array-of-data-to-a-1d-function-with-numpy-or-scipy f xdata x ydata y args 0 # 0 to get only popt param np.apply_along_axis func1d axis 2 arr data See the example.. f xdata x ydata y args 0 # 0 to get only popt param np.apply_along_axis func1d axis 2 arr data share improve..
Solve equation with a set of points http://stackoverflow.com/questions/18619131/solve-equation-with-a-set-of-points return the best fit parameters and the covariance matrix #popt pcov curve_fit myFunc x yn popt pcov curve_fit myFunc x y print.. and the covariance matrix #popt pcov curve_fit myFunc x yn popt pcov curve_fit myFunc x y print popt print pcov #plot the data.. curve_fit myFunc x yn popt pcov curve_fit myFunc x y print popt print pcov #plot the data clf #matplotlib plot x y rs #overplot..
|