Error handling on scipy.optimize.curve_fit

Regarding the documentation on curvefit or leastsq, the notebook does not handle properly the errors on the data leading to wrong parameter error estimate.

They are different way to handle this

  • curve_fit
    • Use the sigma keyword, and the routine will do the rest, or apply the same re-scaling as for leastsq
  • least_sq
    • Either explicitly put the uncertainties in the residual function as
      return (data-model)/sigma
    • Rescale the returned covariance matrix with the variance of the residual as describe in the documentation.

On non related matter, do we really need function like gaussfit1d to explain how to use scipy.optimize.curve_fit ?