| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 7141f40b58ed1e7071cde78ab7bc8ab37e9c5983,
reversing changes made to 8fa6e3bef26a6d4a2c92f2824129aa4409be2590.
The original broke some pandas tests. The current plan to get this
in is
* reversion
* issue FutureWarning in 1.11 and 1.12
* make the change in 1.13.
|
| |
|
|
|
|
| |
behavior of `MaskedArray`'s masks is changing.
|
|
|
|
|
|
|
|
| |
Adds the 'order' parameter to the __new__ override
in MaskedArray construction, enabling it to be enforced
in methods like np.ma.core.array and np.ma.core.asarray.
Closes gh-6646.
|
|
|
|
|
|
|
|
|
| |
Now, NaT compares like NaN:
- NaT != NaT -> True
- NaT == NaT (and all other comparisons) -> False
We discussed this on the mailing list back in October:
https://mail.scipy.org/pipermail/numpy-discussion/2015-October/073968.html
|
|\
| |
| |
| |
| | |
gerritholl/structured_multidim_masked_array_fillvalue
BUG/TST: Fix for #6723 including test: force fill_value.ndim==0
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix issue #6723. Given an exotic masked structured array, where one of
the fields has a multidimensional dtype, make sure that, when accessing
this field, the fill_value still makes sense. As it stands prior to this
commit, the fill_value will end up being multidimensional, possibly with
a shape incompatible with the mother array, which leads to broadcasting
errors in methods such as .filled(). This commit uses the first element
of this multidimensional fill value as the new fill value. When more
than one unique value existed in fill_value, a warning is issued.
Also add a test to verify that fill_value.ndim remains 0 after indexing.
|
| | |
|
| |
| |
| |
| | |
Closes gh-6647.
|
|\ \
| | |
| | | |
MAINT: Simplify some tests using temppath context manager.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This replaces code of the pattern
```
fd, name = tempfile.mkstemp(...)
os.close(fd)
try:
do stuff with name
finally:
os.remove(name)
```
with
```
with temppath() as name:
do stuff with name
```
A few more complicated cases are also handled. The remains some
particularly gnarly code the could probably be refactored to use
temppath, but that is a more demanding project.
|
| | | |
|
|/ / |
|
| | |
|
| |
| |
| |
| | |
Closes gh-6863.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The test currently uses an `<i8` type which is converted to a Python
long integer when running on a 32 bit system with Python 2. That changes
the string printed by appending `L` to the printed integer value and
results in a failed test.
|
|/ |
|
|\
| |
| |
| |
| | |
gerritholl/structured_multidim_masked_array_mvoid_alt
BUG/TST: Fix for #6724, make numpy.ma.mvoid consistent with numpy.void
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make indexing on numpy.ma.mvoid consistent with indexing on numpy.void.
Changes behaviour in rare cases (see below). Fixes #6724. Sometimes,
indexing ma.mvoid results in a non-scalar mask. For example, dimension
increases if indexing with a multi-dimensional field. Previously, this
led to a ValueError (truth value ambiguous). With this commit, indexing
now returns an ma.masked_array so that there is no loss of information.
Note that there is a precedence for returning from void to array. Z =
zeros((2,), dtype="(2,)i2,(2,)i2"), then Z[0] is a void, but Z[0][0]
and Z[0]["f1"] are array. This commit therefore implements behaviouk
such that numpy.ma.mvoid is consistent with numpy.void.
Also adds a related test.
The behaviour changes in cases where for a masked array `X`, X.dtype["A"]
is multidimensional but size 1, such as in the example below. Any case
where X.dtype["A"] is multidimensional but with size>1 would previously
fail.
Old behaviour:
In [15]: X = ma.masked_array(data=[([0],)], mask=[([False],)],
dtype=[("A", "(1,1)i2", (1,1))])
In [16]: X[0]["A"]
Out[16]: array([[[[0]]]], dtype=int16)
In [17]: X = ma.masked_array(data=[([0],)], mask=[([True],)],
dtype=[("A", "(1,1)i2", (1,1))])
In [18]: X[0]["A"]
Out[18]: masked
New behaviour:
In [1]: X = ma.masked_array(data=[([0],)], mask=[([False],)],
dtype=[("A", "(1,1)i2", (1,1))])
In [2]: X[0]["A"]
Out[2]:
masked_array(data =
[[[[0]]]],
mask =
[[[[False]]]],
fill_value = [[[[16959]]]])
In [3]: X = ma.masked_array(data=[([0],)], mask=[([True],)],
dtype=[("A", "(1,1)i2", (1,1))])
In [4]: X[0]["A"]
Out[4]:
masked_array(data =
[[[[--]]]],
mask =
[[[[ True]]]],
fill_value = [[[[16959]]]])
The new behaviour is more consistent with indexing the data themselves:
In [7]: X.data[0]["A"]
Out[7]: array([[[[0]]]], dtype=int16)
In theory, this change in behaviour can break code, but I would consider
it very unlikely.
|
|/
|
|
|
|
| |
Fix #6760. In ma.core._recursive_make_descr, consider the case where a
subdtype does itself have named fields. This ensures the correct mask for
an array like `ma.zeros(2, dtype([("A", "(2,2)i1,(2,2)i1", (2,2))]))`.
|
|\
| |
| | |
ENH: Avoid memory peak when creating a MaskedArray with mask=True/False.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
When the `mask` parameter is set to True or False, create directly a `ndarray` of
boolean instead of going inside `np.resize` which was causing of memory peak of
~15 times the size of the mask.
|
|\ \
| | |
| | | |
ENH: Avoid memory peak and useless computations when printing a MaskedArray.
|
| | | |
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| | |
Ref #3544.
When printing a `MaskedArray`, the whole array is converted to the object dtype,
whereas only a few values are printed to screen. So the approach here is to cut
the array and keep only a subset that it used for the string conversion. This
way the output should not change.
|
|/
|
|
|
|
| |
Fix representation of a structured masked array with dimension zero.
The effect of representing a masked array with dimension zero is now
similar to respresenting an mvoid. This commit fixes #6729.
|
|
|
|
|
|
|
|
|
|
| |
When the mask argument was nomask, commit 8da9c71 changed the behavior
to depend on shrink=True as well, resulting in array(False) false being
returned when shrink=True, which in turn led to bugs because nomask is a
singleton and is detected by `mask is nomask`. That dectection fails
when nomask is replaced by array(False).
Closes #6667.
|
|
|
|
|
| |
Test that ma.dot always returns a masked array.
Test basic that the new out parameter in ma.dot works.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The basic implementation of ma.dot is moved from the method to the function
and the function itself is moved from extras.py to core.py on account of
import complications. The mask_rowcols function from extras is also moved
to core.py as it is needed by dot. For backwards compatibility, both
functions are still exported in extras.__all__ and can be imported
from that module. They are not included in part of core.__all__.
An out parameter is also added to ma.dot.
This PR also closes #6611.
|
|
|
|
|
| |
Fix some long lines and indentation in numpy/ma/core.py and
numpy/ma/extras.py
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the _arraymethod class in ma.core with a function factory which
returns class method wrappers around basic array methods. These methods are
bound to the MaskedArray instance and are immutable.
Previously _arraymethod was a class which would incorrectly operate on the
MaskedArray object which last accessed the particular named function.
closes #5247
|
|\
| |
| | |
BUG: scalar argument to ma.atleast_* return arrays
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The np.ma.atleast_1d, np.ma.atleast_2d, np.ma.atleast_3d and np.ma.diagflat
function return arrays when given a scalar in the same manner as their non-ma
counterparts. Previously these function would return None.
Additionally, the np.ma vstack, row_stack, hstack, column_stack, dstack, and
hsplit functions now raise an expection when given a scalar argument.
closes #3367
|
|/
|
|
|
|
|
|
| |
When called with the shrink parameter set to False, np.ma.masked_values
will create a False filled array mask and not shrink the mask.
Previously the mask would be shrunk to a single False scalar.
closes #2674
|
|\
| |
| | |
BUG: ma.put expands nomask
|
| |
| |
| |
| |
| |
| |
| | |
Previously when put was used on a MaskedArray with nomask the mask would be
incorrectly set to the mask of the values argument.
closes #6425
|
|/
|
|
|
|
| |
The worst case of alternating masked iterated all boundaries and sliced
half away, improve this by only iterating the needed half of the
boundary index array.
|
|\
| |
| | |
BUG: Fixed a bug with string representation of masked structured arrays
|
| |
| |
| |
| |
| | |
This fixes a bug that caused the string representation of masked structured array rows with multi-dimensional columns to fail (numpy/numpy#6019), and includes a regression test.
Since __repr__ suffered from a similar bug, and since previously __repr__ returned the same as __str__ for mvoid, we now set __repr__ to reference the same method as __str__.
|
|\ \
| | |
| | | |
BUG: numpy.ma.round works on zero dimensional arrays
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
numpy.ma.round returns a scalar or np.ma.masked when called with a zero
dimensional array. This behavior is consistent with numpy.round.
closes #2244
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
numpy.ma.empty, zeros, ones, etc can be called using only keyword arguments
without a positional argument. Previously a single positional argument was
required.
For example:
np.ma.zeros(shape=(10, ))
closes #6106
|