title: How to include error bars in lmfit when fitting data to Gaussian profile?
body: <p>I am using lmfit to fit my data to Gaussians. There are three things I am trying to accoplish:
  1) Understand how the errors are calculated in lmfit 
  2) How to include my own calculated errors in lmfit
  3) How to plot the errors within the fit  </p>
  
  <pre><code>def gaussian(x, amp, cen, fwhm):
      return + amp * np.exp(-(x - cen) ** 2 / (2 * (fwhm / 2.35482) ** 2))    
  
  def gaussian_fit(x,y,guess=[1,0,0,5],varies=[True,True,True,True]):
  
  c = 299792458 #m/s
  gmod = Model(gaussian)
  gmod.nan_policy = 'omit'
  #x,y - your dataset to fit, with x and y values
  print (np.max(y))
  gmod.set_param_hint('amp', value=guess[0],vary=varies[0])  
  gmod.set_param_hint('cen', value=guess[1],vary=varies[1])
  gmod.set_param_hint('fwhm', value=guess[2],vary=varies[2])  
  gmod.make_params()
  
  result = gmod.fit(y,x=x,amp=guess[0], cen=guess[1], fwhm=guess[2])
  
  amp = result.best_values['amp']
  cen = result.best_values['cen']
  fwhm = result.best_values['fwhm']
  #level = result.best_values['level']
  sigma = fwhm / 2.35482
  c = 299792458 #m/s
  print(result.fit_report())
  
  gaussfield = amp * np.sqrt(2 * np.pi * sigma ** 2)
  residual = y - result.best_fit
  
  print ('params:',amp,cen,fwhm,sigma,gaussfield)
  return amp,cen,fwhm,sigma,gaussfield,residual
  
  amp, cen, fwhm, sigma, gaussfield, residual 
  = gaussian_fit(xdata,ydata,guess=[.1,6.9,.02],varies=[True,False,False]) 
  </code></pre>
  
  <p>I don't see where the errors are incorporated in the script, so how were they included in the final report? How can you include your own errors instead of the ones fro lmfit, and how can you finally plot these errors?</p>