Closed ivan-usov closed 4 years ago
This happens when constraints are not applied on the fitting parameters when fitting something that doesent fit the model. Often no peak scenario when one tries to fit a gaussian on it. Do you suggest: Try: fit except ValueError: print("select appropriate constraints") ..?
út 20. 10. 2020 v 11:11 odesílatel Ivan Usov notifications@github.com napsal:
Trying to fit the measurement 75 in zebra2020n000039.ccl with all default fitting parameters fails with:
File "/das/home/usov_i/pyzebra/pyzebra/fit2.py", line 132, in fitccl y, params, weights=[np.abs(1 / y_err[i]) for i in range(len(y_err))], x=x, calc_covar=True File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/lmfit/model.py", line 1013, in fit output.fit(data=data, weights=weights) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/lmfit/model.py", line 1366, in fit _ret = self.minimize(method=self.method) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/lmfit/minimizer.py", line 2285, in minimize return function(kwargs) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/lmfit/minimizer.py", line 1646, in leastsq lsout = scipy_leastsq(self.__residual, variables, lskws) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/scipy/optimize/minpack.py", line 410, in leastsq shape, dtype = _check_func('leastsq', 'func', func, x0, args, n) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/scipy/optimize/minpack.py", line 24, in _check_func res = atleast_1d(thefunc(*((x0[:numinputs],) + args))) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/lmfit/minimizer.py", line 591, in __residual nan_policy=self.nan_policy) File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/lmfit/minimizer.py", line 2366, in _nan_policy raise ValueError(msg) ValueError: NaN values detected in your input data or the output of your objective/model function - fitting algorithms cannot handle this! Please read https://lmfit.github.io/lmfit-py/faq.html#i-get-errors-from-nan-in-my-fit-what-can-i-do for more information.
Some error handling needs to be done here.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paulscherrerinstitute/pyzebra/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM2BBRQMTLGWXD4EAIGCZVLSLVH2VANCNFSM4SX5HEKA .
Trying to fit the measurement 75 in
zebra2020n000039.ccl
with all default fitting parameters fails with:Some error handling needs to be done here.