title: Getting standard error associated with parameter estimates from scipy.optimize.curve_fit
body: <p>I am using <code>scipy.optimize.curve_fit</code> to fit a curve to some data i have. The curves, for the most part, seem to fit very well. For some reason, pcov = inf when i print it off.</p>
  
  <p>What i really need is to calculate the error associated with the parameters i'm fitting, and am not sure how exactly to do this even if it does give me the covariance matrix.</p>
  
  <p>The model being fit to is:</p>
  
  <pre><code>def intensity(x,R_out,R_in,K_in,K_out,a,b,c):
      K_in,K_out = abs(0.0),abs(K_out)
      if x&lt;=R_in:
          return 2*R_out*(K_out*np.sqrt(1-x**2/R_out**2)-
                  (K_out-0.0)*np.sqrt(R_in**2/R_out**2-x**2/R_out**2)) + c
      elif x&gt;=R_in and x&lt;=R_out:
          return K_out*2*R_out*np.sqrt(1-x**2/R_out**2) + c
      elif x&gt;R_out:
          return c
  
  intensity_vec = np.vectorize(intensity)
  
  
  
  def intensity_vec_self(x,R_out,R_in,K_in,K_out,a,b,c):
      y = np.zeros(x.shape)
      for i in range(len(y)):
          y[i]=intensity_vec(x[i],R_out,R_in,K_in,K_out,a,b,c)
      return y
  </code></pre>
  
  <p>and there are 400 data points, i can put that on here if you think it will help.</p>
  
  <p>To summarize, i can't get <code>curve_fit</code> to print off my <code>pcov</code> and need help as to figure out why and if i can get it to do so.</p>
  
  <p>Also, if it is a quick explanation i would like to know how to use the <code>pcov</code> array to attain the errors associated with my fit.</p>
  
  <p>Thanks</p>