lmfit / lmfit-py

Non-Linear Least Squares Minimization, with flexible Parameter settings, based on scipy.optimize, and with many additional classes and methods for curve fitting.
https://lmfit.github.io/lmfit-py/
Other
1.05k stars 274 forks source link

Error on ppc64el pybuild --test --test-pytest -i python{version} -p 3.9 returned exit code 13 #686

Closed picca closed 3 years ago

picca commented 3 years ago

Hello, I just got this bug repport, I do not know if this platform is supported, but nevertheless, I report it here.

have a good day.

Frederic

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976952

> =================================== FAILURES ===================================
> _________________ TestUserDefiniedModel.test_model_nan_policy __________________
> 
> self = <test_model.TestUserDefiniedModel testMethod=test_model_nan_policy>
> 
>     def test_model_nan_policy(self):
>         """Tests for nan_policy with NaN values in the input data."""
>         x = np.linspace(0, 10, 201)
>         np.random.seed(0)
>         y = gaussian(x, 10.0, 6.15, 0.8)
>         y += gaussian(x, 8.0, 6.35, 1.1)
>         y += gaussian(x, 0.25, 6.00, 7.5)
>         y += np.random.normal(size=len(x), scale=0.5)
>     
>         # with NaN values in the input data
>         y[55] = y[91] = np.nan
>         mod = PseudoVoigtModel()
>         params = mod.make_params(amplitude=20, center=5.5,
>                                  sigma=1, fraction=0.25)
>         params['fraction'].vary = False
>     
>         # with raise, should get a ValueError
>         result = lambda: mod.fit(y, params, x=x, nan_policy='raise')
>         msg = ('NaN values detected in your input data or the output of your '
>                'objective/model function - fitting algorithms cannot handle this!')
>         self.assertRaisesRegex(ValueError, msg, result)
>     
>         # with propagate, should get no error, but bad results
>         result = mod.fit(y, params, x=x, nan_policy='propagate')
> >       self.assertTrue(result.success)
> E       AssertionError: False is not true
> 
> tests/test_model.py:647: AssertionError
> =============================== warnings summary ===============================
> .pybuild/cpython3_3.9_lmfit/build/tests/test_lineshapes.py::test_no_ZeroDivisionError_and_finite_output[logistic]
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lmfit/build/lmfit/lineshapes.py:184: RuntimeWarning: overflow encountered in exp
>     return amplitude*(1. - 1./(1. + exp((x-center)/max(tiny, sigma))))
> 
> .pybuild/cpython3_3.9_lmfit/build/tests/test_lineshapes.py::test_no_ZeroDivisionError_and_finite_output[thermal_distribution]
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lmfit/build/lmfit/lineshapes.py:344: RuntimeWarning: divide by zero encountered in true_divide
>     return real(1/(amplitude*exp((x - center)/kt) + offset + tiny*1j))
> 
> .pybuild/cpython3_3.9_lmfit/build/tests/test_lineshapes.py::test_x_float_value[step]
> .pybuild/cpython3_3.9_lmfit/build/tests/test_lineshapes.py::test_x_float_value[rectangle]
>   <__array_function__ internals>:5: DeprecationWarning: Calling nonzero on 0d arrays is deprecated, as it behaves surprisingly. Use `atleast_1d(cond).nonzero()` if the old behavior was intended. If the context of this warning is of the form `arr[nonzero(cond)]`, just use `arr[cond]`.
> 
> .pybuild/cpython3_3.9_lmfit/build/tests/test_nose.py::CommonMinimizerTest::test_diffev_bounds_check
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lmfit/build/lmfit/minimizer.py:933: RuntimeWarning: ignoring `maxiter` argument to `scalar_minimize()`. Use `max_nfev` instead.
>     warnings.warn(MAXEVAL_Warning % ('maxiter', thisfuncname()),
> 
> -- Docs: https://docs.pytest.org/en/latest/warnings.html
> === 1 failed, 508 passed, 13 skipped, 3 xfailed, 5 warnings in 98.68 seconds ===
> E: pybuild pybuild:353: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lmfit/build; python3.9 -m pytest tests
> dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.9 returned exit code 13
newville commented 3 years ago

@picca Hm, sorry for the trouble. I can believe that nan-propagation would depend on the processor architecture, but it's hard to know what the real problem is without some digging. I do not have access to a PowerPC machine to test and investigate with, but maybe someone else has some idea of how this might be investigated.

FWIW, I believe that some of the warnings have been fixed (say, with b3753db1caf).

newville commented 3 years ago

@picca See https://github.com/newville/asteval/pull/80. Won't fix without persuasion that supporting PowerPC is something worth doing. Just to be clear, this has nothing to do with the technical case here or the perceived quality of testing for lmfit or anything to do with debian.