---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-dcf1f511ed9b> in <module>
----> 1 out1 = fit_data(x, y, pks)
~/Cloud/python/spectra/spectra/fitting.py in fit_data(x, y, peak_pos, peak_type, width)
92 pars['p%s_amp' % i].set(y[p], min=0)
93
---> 94 out = model.fit(y, pars, x=x)
95 return out
96
~/anaconda3/lib/python3.7/site-packages/lmfit/model.py in fit(self, data, params, weights, method, iter_cb, scale_covar, verbose, fit_kws, nan_policy, calc_covar, **kwargs)
1005 nan_policy=self.nan_policy, calc_covar=calc_covar,
1006 **fit_kws)
-> 1007 output.fit(data=data, weights=weights)
1008 output.components = self.components
1009 return output
~/anaconda3/lib/python3.7/site-packages/lmfit/model.py in fit(self, data, params, weights, method, nan_policy, **kwargs)
1353 self.userkws.update(kwargs)
1354 self.init_fit = self.model.eval(params=self.params, **self.userkws)
-> 1355 _ret = self.minimize(method=self.method)
1356
1357 for attr in dir(_ret):
~/anaconda3/lib/python3.7/site-packages/lmfit/minimizer.py in minimize(self, method, params, **kws)
1947 val.lower().startswith(user_method)):
1948 kwargs['method'] = val
-> 1949 return function(**kwargs)
1950
1951
~/anaconda3/lib/python3.7/site-packages/lmfit/minimizer.py in leastsq(self, params, **kws)
1490
1491 try:
-> 1492 lsout = scipy_leastsq(self.__residual, variables, **lskws)
1493 except AbortFitException:
1494 pass
~/anaconda3/lib/python3.7/site-packages/scipy/optimize/minpack.py in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
381 if not isinstance(args, tuple):
382 args = (args,)
--> 383 shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
384 m = shape[0]
385
~/anaconda3/lib/python3.7/site-packages/scipy/optimize/minpack.py 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):
~/anaconda3/lib/python3.7/site-packages/lmfit/minimizer.py in __residual(self, fvars, apply_bounds_transformation)
536 else:
537 return _nan_policy(np.asarray(out).ravel(),
--> 538 nan_policy=self.nan_policy)
539
540 def __jacobian(self, fvars):
~/anaconda3/lib/python3.7/site-packages/lmfit/minimizer.py in _nan_policy(arr, nan_policy, handle_inf)
2164
2165 if contains_nan:
-> 2166 raise ValueError("The input contains nan values")
2167 return arr
2168
ValueError: The input contains nan values