title: Non-linear fitting using scipy.optimize.curvefit
body: <p>I am trying to fit data using an exponential model:</p>
  
  <pre><code>def f(x, F_0, t0, tau):
      return F_0 * np.exp (-(x-t0)/tau)
  </code></pre>
  
  <p>I use <code>scipy.optimize.curve_fit</code> like this:</p>
  
  <pre><code>popt,pcov = curve_fit(f,t,y,maxfev=1000)
  </code></pre>
  
  <p>In theory that should be it, <code>popt</code> should give the values of <code>F_0</code>, <code>t0</code> and <code>tau</code> right? Well it gives me <code>[1,1,1]</code> and <code>pcov=inf</code>. What's going on? </p>
  
  <p>The data I'm running this on is:</p>
  
  <pre><code>t = array([ 6.0989933 ,  6.13041162,  6.16183043,  6.19324923,  6.22466803, 6.25608683,  6.28750563,  6.31892443,  6.35034323,  6.38176203, 6.41318083,  6.44459963,  6.47601843,  6.50743675,  6.53885555, 6.57027435,  6.60169315,  6.63311195,  6.66453075,  6.69594955, 6.72736835,  6.75878716,  6.79020596,  6.82162476,  6.85304356, 6.88446236,  6.91588116,  6.94729996,  6.97871828,  7.01013708, 7.04155588,  7.07297468,  7.10439348,  7.13581228,  7.16723108, 7.19864988,  7.23006868,  7.26148748,  7.29290581,  7.32432461, 7.35574341,  7.38716221,  7.41858101,  7.44999981], dtype=np.float32)
  y = array([  2.70034180e+03,   2.31075024e+03,   1.87097400e+03, 1.37248645e+03,   1.12983032e+03,   1.10378296e+03, 8.75943909e+02,   6.74242004e+02,   6.01329895e+02, 5.63800049e+02,   4.25704498e+02,   4.04536774e+02, 2.78763947e+02,   2.24465073e+02,   1.85565216e+02, 2.08205307e+02,   1.77108429e+02,   1.38598465e+02, 1.22449684e+02,   9.47472382e+01,   8.18683701e+01, 5.92218361e+01,   5.29379654e+01,   4.54894447e+01, 3.65242805e+01,   2.95051060e+01,   2.47274208e+01, 2.26564598e+01,   1.64215832e+01,   1.41874876e+01, 1.23035212e+01,   1.25391512e+01,   8.86111355e+00, 7.04269171e+00,   6.07329178e+00,   4.73968601e+00, 4.60453558e+00,   3.97630429e+00,   3.36820292e+00, 2.52790380e+00,   2.28720117e+00,   2.09139872e+00, 1.46813798e+00,   1.18916214e+00], dtype=np.float32)
  </code></pre>
  
  <p>I tried adding initial values close to the real values,</p>
  
  <pre><code>x0 = np.array([2500,6,0.15])
  popt,pcov = curve_fit(f,t,y,x0,maxfev=1000)`
  </code></pre>
  
  <p><code>popt</code> now gives me the values of <code>x0</code>.</p>