summaryrefslogtreecommitdiff
path: root/numpy/ma/tests/test_extras.py
AgeCommit message (Collapse)AuthorFilesLines
2018-03-25BUG: Always return a list from np.ma.flatnotmasked_contiguousEric Wieser1-4/+7
Depending on the input, this would return: * A single slice, if mask=nomask * A list of slices, if mask is an array * None, if mask is fully masked The documented return value is a list, and all downstream callers of this function end up having to correct for it not being one. This affects the result of np.ma.notmasked_contiguous, which also did not document these unusual return values.
2018-03-25TST: simplify test of notmasked_contiguousEric Wieser1-13/+22
2018-01-18STY: Break some long lines.Charles Harris1-1/+2
[ci skip]
2018-01-10ref to issue in numpy.maAnas Khan1-0/+1
2018-01-09adding new tests for union1dAnas Khan1-0/+6
2017-12-17ENH: added masked version of 'numpy.stack' with tests.lzkelley1-1/+83
Uses '_fromnxfunction_seq' just like 'vstack', 'hstack', etc. Added release note to 1.15.0.
2017-12-11ENH: Allow np.r_ to accept 0d arraysEric Wieser1-0/+9
Fixes gh-9233
2017-08-05MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser1-2/+2
This is the case for x in {int, bool, str, float, complex, object}. Using the np.{x} version is deceptive as it suggests that there is a difference. This change doesn't affect any external behaviour. The `long` type is missing in python 3, so np.long is still useful
2017-07-24TST: Remove unittest dependencies in numpy/ma/tests.Charles Harris1-34/+33
2017-06-03BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser1-1/+1
Bare except is very rarely the right thing
2017-05-05BUG: np.ma.mr_['r',...] does not return masked arraysEric Wieser1-0/+10
2017-05-05MAINT: Remove code duplicated from np.r_ in np.ma.mr_Eric Wieser1-1/+4
Also adds a test for the disabled-by-design behaviour - this would return raw matrices, not masked arrays
2017-05-05ENH: Add isin, genereralizing in1d to ND arrays (#8423)B R S Recht1-1/+22
This fixes gh-8331 Also update the docs for arraysetops to remove the outdated "1D" from the description, which was already incorrect for np.unique.
2017-03-28MAINT: Use _validate_axis inside _ureduceEric Wieser1-1/+1
This fixes an omission where duplicate axes would only be detected when positive
2017-02-27BUG: fix ma.median for empty ndarraysJulian Taylor1-3/+3
return nan as it did in 1.11 and same as normal median. closes gh-8703
2017-02-09MAINT: Remove __setslice__ and __getslice__Eric Wieser1-5/+0
This code was only here for Python 2.5 compatibility, but numpy requires 2.7 at minimum
2017-01-17BUG: fix wrong masked median for some special casesJulian Taylor1-0/+22
the masked nans which are equivalent to valid infs must be replaced with infs earlier otherwise the inf is lost in the masked sum of the low and high part. Closes gh-8487
2016-12-25TST: extend ma.median testing and fix inconsistent out returnJulian Taylor1-10/+59
2016-12-23BUG: fixed failure of np.ma.median for 1-D even arrays.Marten van Kerkwijk1-2/+6
For such arrays, the sum of the two entries closest to the middle was not divided by 2. Now fixed, with test cases adapted to ensure this stays OK.
2016-12-12BUG: handle unmasked NaN in ma.median like normal medianJulian Taylor1-0/+186
This requires to base masked median on sort(endwith=False) as we need to distinguish Inf and NaN. Using Inf as filler element of the sort does not work as then the mask is not guaranteed to be at the end. Closes gh-8340 Also fixed 1d ma.median not handling np.inf correctly, the nd variant was ok.
2016-09-07BUG: fix np.ma.median with only one non-masked valueLoïc Estève1-0/+9
and an axis argument. Add test.
2016-09-05TST: Add ma.median tests for valid axis.Charles Harris1-0/+32
2016-09-02MAINT: Spell out with and without in ma test functionsSebastian Berg1-8/+8
they used to be called `..._w_...` and `..._wo_...`.
2016-09-02TST: Use new warnings context manager in all testsSebastian Berg1-21/+15
In some places, just remove aparently unnecessary filters. After this, all cases of ignore filters should be removed from the tests, making testing (even multiple runs) normally fully predictable.
2016-08-24BUG: Fixed masked array behavior for scalar inputs to np.ma.atleast_*dJoseph Fox-Rabinovitz1-5/+30
2016-08-07BUG: fix for issue#7835 (ma.median of 1d)Shota Kawabuchi1-4/+38
2016-05-22BUG: ma.median of 1d array should return a scalarAmit Aronovitch1-0/+13
Fixes #5969. Performance fix #4760 had caused wrong shaped results in the 1D case. This fix restores the original 1D behavior.
2016-02-26TST: Fix some MA tests to avoid looking at the .data attributeAllan Haldane1-9/+9
The MaskedArray.data attribute is unreliable for tests because it can contain arbitraty junk data at masked positions. Instead, all MaskedArray tests should look at marr.filled(0) to check if we got the same result.
2016-01-16Revert "Merge pull request #7001 from shoyer/NaT-comparison"Charles Harris1-1/+1
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.
2016-01-14TST, ENH: make all comparisons with NaT falseStephan Hoyer1-1/+1
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
2015-11-10TST: Add tests for ma.dot.Charles Harris1-19/+35
Test that ma.dot always returns a masked array. Test basic that the new out parameter in ma.dot works.
2015-10-20BUG: scalar argument to ma.atleast_* return arraysJonathan Helmus1-4/+24
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
2015-10-08ENH: improve worst case of ma.clump_maskedJulian Taylor1-0/+20
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.
2015-07-25STY,MAINT: Run pyflakes and pep8 on numpy/ma/tests/*.Charles Harris1-32/+27
Also fix "*" imports. The formatting of test arrays is not fixed for multiple spaces following "," and other violations that are common in tests. To be precise, E241 and E201 are added to the errors that are excluded.
2015-05-07BUG: setdiff1d return dtypeChristian Brodbeck1-0/+2
Fixes #5846 (If called with an empty array as first argument, the returned array had dtype bool instead of the dtype of the input array)
2015-05-03ENH: Introduce np.ma.compress_nd(), generalizes np.ma.compress_rowcols()Daniel da Silva1-5/+117
Provides a way to supress slices along an abitrary tuple of dimensions.
2015-03-15ENH: deprecate bias and ddof arguments to corrcoefMatthew Brett1-14/+68
The bias and ddof arguments had no effect on the calculation of the correlation coefficient because the value cancels in the calculation. Deprecate these arguments to np.corrcoef and np.ma.corrcoef.
2015-02-21BUG: numpy.ma.polyfit masks NaNs incorrectlySimon Gibbons1-0/+15
This fixes the incorrect handing of masked NaNs by ``np.ma.polyfit``. Instead of passing the mask into ``np.polyfit`` by setting the weight of the masked points to zero, the subset of elements of which are to be fitted are passed instead. Closes #5591
2015-01-13BUG: fix ma.median used on ndarraysJulian Taylor1-0/+4
ndarrays have a data attribute pointing to the data buffer which leads to the median working on a byte view instead of the actual type. closes gh-5424
2014-10-14BUG: fix nanmedian on arrays containing infJulian Taylor1-0/+3
There are two issues: A masked divide of an infinite value is a masked value which means one can't use np.ma.mean to compute the median as infinity division is well defined. This behaviour seems wrong to me but it also looks intentional so changing it is not appropriate for a bugfix release. The second issue is that the ordering of the sorted masked array is undefined for equal values, the sorting considers infinity the largest floating point value which is not correct in respect to sorting where nan is considered larger. This is fixed by changing the minimum_fill_value to nan for float data in the masked sorts. Closes gh-5138
2014-06-08Merge pull request #4454 from jurnix/namedargsJulian Taylor1-0/+10
ENH: apply_along_axis accepts named arguments
2014-06-02ENH: rewrite ma.median to improve poor performance for multiple dimensionsJulian Taylor1-0/+13
many masked median along a small dimension is extremely slow due to the usage of apply_along_axis which iterates fully in python. The unmasked median is about 1000x faster. Work around this issue by using indexing to select the median element instead of apply_along_axis. Further improvements are possible, e.g. using the current np.nanmedian approach for masked medians along large dimensions so partition is used instead of sort or to extend partition to allow broadcasting over multiple elements. Closes gh-4683.
2014-04-01BUG: Masked arrays and apply_over_axesLev Abalkin1-1/+2
Masked arrays version of apply_over_axes did not apply function correctly to arrays with non-trivial masks. Fixes #4461.
2014-03-27ENH: apply_along_axis accepts named argumentsAlbert1-0/+10
2013-10-12Convert docstrings to comments for nose; PEP8 cleanup (some tests activated)Marten van Kerkwijk1-65/+65
2013-08-18STY: Giant comma spacing fixup.Charles Harris1-3/+3
Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
2013-06-15BUG: ma: ma.average didn't handle complex arrays correctly (issue gh-2684)Warren Weckesser1-2/+45
2013-06-15MAINT: ma: clean up ma/test_extras.py: don't use 'import *'; PEP8 whitespaceWarren Weckesser1-61/+67
2013-04-08ENH: add `invert` parameter to numpy.in1d().Julien Phalip1-0/+13
2013-04-062to3: Apply `print` fixer.Charles Harris1-1/+1
Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.