Description
This is actually a two-fold bug: one is a failure on mips64el, mipsel, hppa, and the other is that the failure uncovers the use of a wrong assertion.
Expected behavior
This failure happened already before (since ~2019), so it is not new. I actually think this may be connected rather to some pecularities on these platforms then to a bug in astropy, and usually this is just set to xfail locally. However, probably the "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()" should be fixed, although probably more cosmetic.
Actual behavior
On mips64el, mipsel, hppa, I get the following failure during test:
_________________________ TestParse.test_doubleComplex _________________________
comparison = <built-in function eq>
x = masked_array(data=[--, 0j, -1j, --, --],
mask=[ True, False, False, True, True],
fill_value=(1e+20+0j))
y = array([nan +0.j, 0. +0.j, 0. -1.j, nan+infj, nan +0.j]), err_msg = ''
verbose = True
header = 'error during assertion:\n\nTraceback (most recent call last):\n File "/usr/lib/python3/dist-packages/numpy/testing/_... The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()\n\n\nArrays are not equal'
precision = 6, equal_nan = True, equal_inf = True
def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
header='', precision=6, equal_nan=True,
equal_inf=True):
[…]
if equal_inf:
> flagged |= func_assert_same_pos(x, y,
func=lambda xy: xy == +inf,
hasval='+inf')
/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py:767:
[…]
if isinstance(check, (np.bool_, bool)):
> return masked if mask else check
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
/usr/lib/python3/dist-packages/numpy/ma/core.py:4078: ValueError
During handling of the above exception, another exception occurred:
self = <astropy.io.votable.tests.vo_test.TestParse object at 0xffd8593340>
def test_doubleComplex(self):
assert issubclass(self.array['doubleComplex'].dtype.type,
np.complex128)
> assert_array_equal(
self.array['doubleComplex'],
[np.nan+0j, 0+0j, 0+-1j, np.nan+(np.inf*1j), np.nan+0j])
E ValueError:
E error during assertion:
E
E Traceback (most recent call last):
E File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 767, in assert_array_compare
E flagged |= func_assert_same_pos(x, y,
E File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 722, in func_assert_same_pos
E x_id = func(x)
E File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 768, in <lambda>
E func=lambda xy: xy == +inf,
E File "/usr/lib/python3/dist-packages/numpy/ma/core.py", line 4116, in __eq__
E return self._comparison(other, operator.eq)
E File "/usr/lib/python3/dist-packages/numpy/ma/core.py", line 4078, in _comparison
E return masked if mask else check
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
E
E
E Arrays are not equal
E x: MaskedArray([inf+infj, 0. +0.j, 0. -1.j, inf+infj, inf+infj])
E y: array([nan +0.j, 0. +0.j, 0. -1.j, nan+infj, nan +0.j])
astropy/io/votable/tests/vo_test.py:478: ValueError
Full build/test log
Steps to Reproduce
This should happen reproducibly when you run the tests on mips64el, mips, or hppa architectures.
System Details
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3.9
cachedir: .pytest_cache
Matplotlib: 3.3.4
Freetype: 2.11.0
Running tests with Astropy version 5.0-rc1.
Running tests in .pybuild/cpython3_3.9/build.
Date: 2021-11-05T08:52:28
Platform: Linux-5.10.0-9-loongson-3-mips64-with-glibc2.32
Executable: /usr/bin/python3.9
Full Python Version:
3.9.7 (default, Sep 24 2021, 09:43:00)
[GCC 10.3.0]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Package versions:
Numpy: 1.19.5
Scipy: 1.7.1
Matplotlib: 3.3.4
h5py: 3.3.0
Pandas: 1.1.5
PyERFA: 2.0.0
Cython: 0.29.24
Scikit-image: 0.18.3
asdf: not available
pyarrow: not available
Using Astropy options: remote_data: none.
hypothesis profile 'ci' -> database=None, deadline=None, print_blob=True, derandomize=True
ARCH_ON_CI: undefined
IS_CRON: undefined
rootdir: /<>, configfile: setup.cfg
plugins: mpl-0.11, remotedata-0.3.2, openfiles-0.5.0, mock-3.6.1, filter-subpackage-0.1.1, doctestplus-0.11.0, cov-3.0.0, astropy-header-0.1.2, arraydiff-0.3, hypothesis-5.43.3
Description
This is actually a two-fold bug: one is a failure on mips64el, mipsel, hppa, and the other is that the failure uncovers the use of a wrong assertion.
Expected behavior
This failure happened already before (since ~2019), so it is not new. I actually think this may be connected rather to some pecularities on these platforms then to a bug in astropy, and usually this is just set to xfail locally. However, probably the "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()" should be fixed, although probably more cosmetic.
Actual behavior
On mips64el, mipsel, hppa, I get the following failure during test:
_________________________ TestParse.test_doubleComplex _________________________ comparison = <built-in function eq> x = masked_array(data=[--, 0j, -1j, --, --], mask=[ True, False, False, True, True], fill_value=(1e+20+0j)) y = array([nan +0.j, 0. +0.j, 0. -1.j, nan+infj, nan +0.j]), err_msg = '' verbose = True header = 'error during assertion:\n\nTraceback (most recent call last):\n File "/usr/lib/python3/dist-packages/numpy/testing/_... The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()\n\n\nArrays are not equal' precision = 6, equal_nan = True, equal_inf = True def assert_array_compare(comparison, x, y, err_msg='', verbose=True, header='', precision=6, equal_nan=True, equal_inf=True): […] if equal_inf: > flagged |= func_assert_same_pos(x, y, func=lambda xy: xy == +inf, hasval='+inf') /usr/lib/python3/dist-packages/numpy/testing/_private/utils.py:767: […] if isinstance(check, (np.bool_, bool)): > return masked if mask else check E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() /usr/lib/python3/dist-packages/numpy/ma/core.py:4078: ValueError During handling of the above exception, another exception occurred: self = <astropy.io.votable.tests.vo_test.TestParse object at 0xffd8593340> def test_doubleComplex(self): assert issubclass(self.array['doubleComplex'].dtype.type, np.complex128) > assert_array_equal( self.array['doubleComplex'], [np.nan+0j, 0+0j, 0+-1j, np.nan+(np.inf*1j), np.nan+0j]) E ValueError: E error during assertion: E E Traceback (most recent call last): E File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 767, in assert_array_compare E flagged |= func_assert_same_pos(x, y, E File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 722, in func_assert_same_pos E x_id = func(x) E File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 768, in <lambda> E func=lambda xy: xy == +inf, E File "/usr/lib/python3/dist-packages/numpy/ma/core.py", line 4116, in __eq__ E return self._comparison(other, operator.eq) E File "/usr/lib/python3/dist-packages/numpy/ma/core.py", line 4078, in _comparison E return masked if mask else check E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() E E E Arrays are not equal E x: MaskedArray([inf+infj, 0. +0.j, 0. -1.j, inf+infj, inf+infj]) E y: array([nan +0.j, 0. +0.j, 0. -1.j, nan+infj, nan +0.j]) astropy/io/votable/tests/vo_test.py:478: ValueErrorFull build/test log
Steps to Reproduce
This should happen reproducibly when you run the tests on mips64el, mips, or hppa architectures.
System Details
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3.9
cachedir: .pytest_cache
Matplotlib: 3.3.4
Freetype: 2.11.0
Running tests with Astropy version 5.0-rc1.
Running tests in .pybuild/cpython3_3.9/build.
Date: 2021-11-05T08:52:28
Platform: Linux-5.10.0-9-loongson-3-mips64-with-glibc2.32
Executable: /usr/bin/python3.9
Full Python Version:
3.9.7 (default, Sep 24 2021, 09:43:00)
[GCC 10.3.0]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Package versions:
Numpy: 1.19.5
Scipy: 1.7.1
Matplotlib: 3.3.4
h5py: 3.3.0
Pandas: 1.1.5
PyERFA: 2.0.0
Cython: 0.29.24
Scikit-image: 0.18.3
asdf: not available
pyarrow: not available
Using Astropy options: remote_data: none.
hypothesis profile 'ci' -> database=None, deadline=None, print_blob=True, derandomize=True
ARCH_ON_CI: undefined
IS_CRON: undefined
rootdir: /<>, configfile: setup.cfg
plugins: mpl-0.11, remotedata-0.3.2, openfiles-0.5.0, mock-3.6.1, filter-subpackage-0.1.1, doctestplus-0.11.0, cov-3.0.0, astropy-header-0.1.2, arraydiff-0.3, hypothesis-5.43.3