dkriegner / xrayutilities

xrayutilities - a package with useful scripts for X-ray diffraction physicists
http://xrayutilities.sourceforge.io
GNU General Public License v2.0
83 stars 29 forks source link

intermitent error ValueError: zero-size array to reduction operation maximum which has no identity #102

Closed picca closed 4 years ago

picca commented 4 years ago

Hello, I have these errors from time to time.

https://salsa.debian.org/science-team/python-xrayutilities/-/jobs/915302/raw

In this case with python3.8 it failed but with python3.8-dbg, it was ok

======================================================================
ERROR: test_omega_cut (tests.test_analysis_linecuts.Test_analysis_linecuts)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/autopkgtest-lxc.zlv2d7gg/downtmp/autopkgtest_tmp/tests/test_analysis_linecuts.py", line 54, in test_omega_cut
    x, d, m = xu.analysis.get_omega_scan(
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 384, in get_omega_scan
    ret = _get_cut(om, tt-ttcut, intensity, intrange/2., npoints)
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 59, in _get_cut
    width = (numpy.max(pos_a[ma]) - numpy.min(pos_a[ma])) / float(npoints)
  File "<__array_function__ internals>", line 5, in amax
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 2705, in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

======================================================================
ERROR: test_qy_cut (tests.test_analysis_linecuts.Test_analysis_linecuts)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/autopkgtest-lxc.zlv2d7gg/downtmp/autopkgtest_tmp/tests/test_analysis_linecuts.py", line 91, in test_qy_cut
    x, d, m = xu.analysis.get_qy_scan(
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 238, in get_qy_scan
    ret = _get_cut(qypos, tt-ttcut, intensity, intrange/2., npoints)
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 59, in _get_cut
    width = (numpy.max(pos_a[ma]) - numpy.min(pos_a[ma])) / float(npoints)
  File "<__array_function__ internals>", line 5, in amax
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 2705, in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

======================================================================
ERROR: test_qz_cut (tests.test_analysis_linecuts.Test_analysis_linecuts)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/autopkgtest-lxc.zlv2d7gg/downtmp/autopkgtest_tmp/tests/test_analysis_linecuts.py", line 80, in test_qz_cut
    x, d, m = xu.analysis.get_qz_scan(
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 145, in get_qz_scan
    ret = _get_cut(qzpos, tt-ttcut, intensity, intrange/2., npoints)
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 59, in _get_cut
    width = (numpy.max(pos_a[ma]) - numpy.min(pos_a[ma])) / float(npoints)
  File "<__array_function__ internals>", line 5, in amax
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 2705, in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

======================================================================
ERROR: test_radial_cut (tests.test_analysis_linecuts.Test_analysis_linecuts)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/autopkgtest-lxc.zlv2d7gg/downtmp/autopkgtest_tmp/tests/test_analysis_linecuts.py", line 41, in test_radial_cut
    x, d, m = xu.analysis.get_radial_scan(
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 463, in get_radial_scan
    ret = _get_cut(tt-2*(tt/2-om-offcut), 2*(tt/2-om-offcut), intensity,
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 59, in _get_cut
    width = (numpy.max(pos_a[ma]) - numpy.min(pos_a[ma])) / float(npoints)
  File "<__array_function__ internals>", line 5, in amax
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 2705, in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

======================================================================
ERROR: test_ttheta_cut (tests.test_analysis_linecuts.Test_analysis_linecuts)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/autopkgtest-lxc.zlv2d7gg/downtmp/autopkgtest_tmp/tests/test_analysis_linecuts.py", line 67, in test_ttheta_cut
    x, d, m = xu.analysis.get_ttheta_scan(
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 538, in get_ttheta_scan
    ret = _get_cut(tt-2*(om-ocut), 2*(om-ocut), intensity,
  File "/usr/lib/python3/dist-packages/xrayutilities/analysis/line_cuts.py", line 59, in _get_cut
    width = (numpy.max(pos_a[ma]) - numpy.min(pos_a[ma])) / float(npoints)
  File "<__array_function__ internals>", line 5, in amax
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 2705, in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

----------------------------------------------------------------------
Ran 230 tests in 92.243s

FAILED (errors=5, skipped=69)
picca commented 4 years ago

A second run gives no error

https://salsa.debian.org/science-team/python-xrayutilities/-/jobs/915312

dkriegner commented 4 years ago

I have seen this happening as well... I think its a bad test scenario where some random numbers used in the input generation produce invalid input...

will investigate, but will need some time

On Thu, Aug 6, 2020 at 4:53 PM picca notifications@github.com wrote:

A second run gives no error

https://salsa.debian.org/science-team/python-xrayutilities/-/jobs/915312

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dkriegner/xrayutilities/issues/102#issuecomment-669977660, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACKZJFNHT5LTPWE2U4NUZIDR7K7VNANCNFSM4PWVBWKA .

dkriegner commented 4 years ago

although not with absolute certainty due to the intermittent nature of the error, but the mentioned commit should fix this issue.

btw: I also looked at the other warnings seen in your test run. some of them should be fixed in GIT master, but especially the ones regarding matplotlib API changes will remain for the moment since I prefer not to raise the required matplotlib version at the moment.