-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Closed
Labels
Description
Describe the issue:
In numpy 2.0 nightly, applying sqrt() to a fully masked scalar array undoes the mask.
numpy 1.26.3 behaves correctly.
Other ufuncs seem to behave correctly (but I haven't performed a thorough test for all of them).
Reproduce the code example:
>>> import numpy as np
>>> a = np.ma.masked_array(1, mask=True)
>>> type(a)
numpy.ma.core.MaskedArray
>>> np.sqrt(a)
# numpy 2.0
masked_array(data=1.,
mask=False,
fill_value=1e+20)
# numpy 1.26.3
masked_array(data=--,
mask=True,
fill_value=1e+20,
dtype=float64)
>>> np.sqrt(np.ma.masked)
# numpy 2.0
masked_array(data=0.,
mask=False,
fill_value=1e+20)
# numpy 1.26.3
masked_array(data=--,
mask=True,
fill_value=1e+20,
dtype=float64)Error message:
No response
Python and NumPy Versions:
CPython 3.12.1 x86_64
numpy 2.0.0.dev0+git20240113.d2f60ff
from
python -m pip install --no-deps --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
as of 2024-01-19
Runtime Environment:
No response
Context for the issue:
No response
Reactions are currently unavailable