[(0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2), (0.2, 2)]
(0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0, 0.20000000000000001, 2.0)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-2-04aa0b8023cd> in <module>()
21 expected = [(0.2,2) for i in range(36)]
22 print expected
---> 23 params,cov=curve_fit(hund_modal,x,y,expected)
24 sigma=np.sqrt(np.diag(cov))
25 print params
/usr/local/lib/python2.7/dist-packages/scipy/optimize/minpack.pyc in curve_fit(f, xdata, ydata, p0, sigma, absolute_sigma, check_finite, bounds, method, jac, **kwargs)
674 # Remove full_output from kwargs, otherwise we're passing it in twice.
675 return_full = kwargs.pop('full_output', False)
--> 676 res = leastsq(func, p0, Dfun=jac, full_output=1, **kwargs)
677 popt, pcov, infodict, errmsg, ier = res
678 cost = np.sum(infodict['fvec'] ** 2)
/usr/local/lib/python2.7/dist-packages/scipy/optimize/minpack.pyc in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
375 if not isinstance(args, tuple):
376 args = (args,)
--> 377 shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
378 m = shape[0]
379 if n > m:
/usr/local/lib/python2.7/dist-packages/scipy/optimize/minpack.pyc in _check_func(checker, argname, thefunc, x0, args, numinputs, output_shape)
24 def _check_func(checker, argname, thefunc, x0, args, numinputs,
25 output_shape=None):
---> 26 res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
27 if (output_shape is not None) and (shape(res) != output_shape):
28 if (output_shape[0] != 1):
/usr/local/lib/python2.7/dist-packages/scipy/optimize/minpack.pyc in func_wrapped(params)
453 if weights is None:
454 def func_wrapped(params):
--> 455 return func(xdata, *params) - ydata
456 else:
457 def func_wrapped(params):
<ipython-input-2-04aa0b8023cd> in hund_modal(x, *params)
16 for i in range(-180,180,10):
17 print params
---> 18 print params[i]
19 result += gauss(x, i, params[i][0], params[i][1])
20 return result
IndexError: tuple index out of range