Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Created September 23, 2018 06:25
Show Gist options
  • Save thomasaarholt/b25afd3ea963022be4753e6410fedf19 to your computer and use it in GitHub Desktop.
Save thomasaarholt/b25afd3ea963022be4753e6410fedf19 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-39-840bfeb05f2a> in <module>()
----> 1 m.fit_background(bounded=True)
c:\users\me\documents\github\hyperspy\hyperspy\models\edsmodel.py in fit_background(self, start_energy, end_energy, windows_sigma, kind, **kwargs)
445 windows_sigma[1] * component.sigma.value)
446 if kind == 'single':
--> 447 self.fit(**kwargs)
448 if kind == 'multi':
449 self.multifit(**kwargs)
c:\users\me\documents\github\hyperspy\hyperspy\model.py in fit(self, fitter, method, grad, bounded, ext_bounding, update_plot, **kwargs)
1064 output = \
1065 least_squares(self._errfunc, self.p0[:],
-> 1066 args=args, bounds=ls_b, **kwargs)
1067 self.p0 = output.x
1068
C:\ProgramData\Anaconda3\envs\py\lib\site-packages\scipy\optimize\_lsq\least_squares.py in least_squares(fun, x0, jac, bounds, method, ftol, xtol, gtol, x_scale, loss, f_scale, diff_step, tr_solver, tr_options, jac_sparsity, max_nfev, verbose, args, kwargs)
797 x0 = make_strictly_feasible(x0, lb, ub)
798
--> 799 f0 = fun_wrapped(x0)
800
801 if f0.ndim != 1:
C:\ProgramData\Anaconda3\envs\py\lib\site-packages\scipy\optimize\_lsq\least_squares.py in fun_wrapped(x)
792
793 def fun_wrapped(x):
--> 794 return np.atleast_1d(fun(x, *args, **kwargs))
795
796 if method == 'trf':
c:\users\me\documents\github\hyperspy\hyperspy\models\model1d.py in _errfunc(self, param, y, weights)
437 if weights is None:
438 weights = 1.
--> 439 errfunc = self._model_function(param) - y
440 return errfunc * weights
441
c:\users\me\documents\github\hyperspy\hyperspy\model.py in _model_function(self, param)
838 self.p0 = param
839 self._fetch_values_from_p0()
--> 840 to_return = self.__call__(non_convolved=False, onlyactive=True)
841 return to_return
842
c:\users\me\documents\github\hyperspy\hyperspy\models\model1d.py in __call__(self, non_convolved, onlyactive)
402 for component in self:
403 if component.active:
--> 404 sum_ += component.function(axis)
405 else:
406 for component in self:
c:\users\me\documents\github\hyperspy\hyperspy\_components\physical_background.py in function(self, x)
279 Cthickness=self.coating_thickness.value
280
--> 281 Mu=Mucoef(self.model,self.quanti.value)
282 Mu=np.array(Mu,dtype=float)
283 #Mu=Mu[self.model.channel_switches]
c:\users\me\documents\github\hyperspy\hyperspy\_components\physical_background.py in Mucoef(model, quanti)
140
141 if np.sum(quanti)==0:
--> 142 raise ValueError("The quantification cannot be nul, but an an array with all weight percents set to 0 have been provided" )
143 else:
144 t=(np.linspace(model._signal.axes_manager[-1].offset,model._signal.axes_manager[-1].size*model._signal.axes_manager[-1].scale,model._signal.axes_manager[-1].size))
ValueError: The quantification cannot be nul, but an an array with all weight percents set to 0 have been provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment