---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-16-cb95ef8a51ab> in <module>()
----> 1 theta_best, theta_cov = opt.curve_fit(msd, tdata, ydata,absolute_sigma=True)
/usr/local/lib/python3.4/dist-packages/scipy/optimize/minpack.py in curve_fit(f, xdata, ydata, p0, sigma, absolute_sigma, check_finite, **kw)
579 # Remove full_output from kw, otherwise we're passing it in twice.
580 return_full = kw.pop('full_output', False)
--> 581 res = leastsq(func, p0, args=args, full_output=1, **kw)
582 (popt, pcov, infodict, errmsg, ier) = res
583
/usr/local/lib/python3.4/dist-packages/scipy/optimize/minpack.py in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
369 if not isinstance(args, tuple):
370 args = (args,)
--> 371 shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
372 m = shape[0]
373 if n > m:
/usr/local/lib/python3.4/dist-packages/scipy/optimize/minpack.py in _check_func(checker, argname, thefunc, x0, args, numinputs, output_shape)
18 def _check_func(checker, argname, thefunc, x0, args, numinputs,
19 output_shape=None):
---> 20 res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
21 if (output_shape is not None) and (shape(res) != output_shape):
22 if (output_shape[0] != 1):
/usr/local/lib/python3.4/dist-packages/scipy/optimize/minpack.py in _general_function(params, xdata, ydata, function)
445
446 def _general_function(params, xdata, ydata, function):
--> 447 return function(xdata, *params) - ydata
448
449
<ipython-input-12-6655345c1744> in msd(t, V)
1 def msd(t,V):
----> 2 return 4*D*t + ((V**2)*(tau**2)/3)*((2*t/tau) + np.exp(-2*t/tau) - 1)
NameError: name 'D' is not defined