summaryrefslogtreecommitdiff
path: root/numpy/ma/extras.py
Commit message (Collapse)AuthorAgeFilesLines
...
* BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-1/+1
| | | | Bare except is very rarely the right thing
* ENH: Spelling fixesVille Skyttä2017-05-091-4/+4
|
* BUG: np.ma.mr_['r',...] does not return masked arraysEric Wieser2017-05-051-0/+4
|
* MAINT: Remove code duplicated from np.r_ in np.ma.mr_Eric Wieser2017-05-051-50/+5
| | | | | Also adds a test for the disabled-by-design behaviour - this would return raw matrices, not masked arrays
* ENH: Add isin, genereralizing in1d to ND arrays (#8423)B R S Recht2017-05-051-1/+28
| | | | | | 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.
* MAINT: Rename _validate_axis, and document itEric Wieser2017-03-281-2/+2
|
* MAINT: Reuse _validate_axis in maEric Wieser2017-03-281-11/+5
|
* BUG: fix ma.median for empty ndarraysJulian Taylor2017-02-271-0/+7
| | | | | return nan as it did in 1.11 and same as normal median. closes gh-8703
* MAINT: Use normalize_axis_index in all python axis checkingEric Wieser2017-02-201-7/+4
| | | | | | | As a result, some exceptions change from ValueError to IndexError This also changes the exception types raised in places where normalize_axis_index is not quite appropriate
* MAINT: remove ma out= workaroundJulian Taylor2017-02-061-4/+0
| | | | unnecessary since gh-8416
* BUG: fix wrong masked median for some special casesJulian Taylor2017-01-171-6/+13
| | | | | | | 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
* TST: extend ma.median testing and fix inconsistent out returnJulian Taylor2016-12-251-0/+4
|
* BUG: fixed failure of np.ma.median for 1-D even arrays.Marten van Kerkwijk2016-12-231-2/+3
| | | | | | 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.
* BUG: handle unmasked NaN in ma.median like normal medianJulian Taylor2016-12-121-10/+42
| | | | | | | | | | | 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.
* BUG: fix np.ma.median with only one non-masked valueLoïc Estève2016-09-071-2/+1
| | | | and an axis argument. Add test.
* BUG: Fix numpy.ma.median for various things.Charles Harris2016-09-051-8/+11
| | | | | | | | | | | This fixes four bugs: - Use of booleans for indexing in ma.extras._median - Error when mask is nomask and ndim != 1 in ma.extras._median - Did not work for 0-d arrays. - No out argument for {0,1}-d arrays. Closes #8015.
* ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-1/+1
|
* BUG: Fixed masked array behavior for scalar inputs to np.ma.atleast_*dJoseph Fox-Rabinovitz2016-08-241-43/+99
|
* BUG: modified ndim condition to use masked_arrayskwbc2016-08-071-1/+1
|
* BUG: fix for issue#7835 (ma.median of 1d)Shota Kawabuchi2016-08-071-4/+8
|
* STY: ma.extras.median: avoid indexing with listAmit Aronovitch2016-05-221-2/+2
| | | | Recommended type for nd-indexing is a tuple. See #4434
* BUG: ma.median of 1d array should return a scalarAmit Aronovitch2016-05-221-1/+5
| | | | | | Fixes #5969. Performance fix #4760 had caused wrong shaped results in the 1D case. This fix restores the original 1D behavior.
* ENH: update MA average, medianAllan Haldane2016-04-041-88/+61
|
* ENH: Make no unshare mask future warnings less noisySebastian Berg2016-03-011-2/+4
| | | | | Incorporates Nathaniels suggestions for a longer explanation in the release notes.
* DOC: Use print only as function when print_function is imported from __future__gfyoung2015-12-191-7/+7
| | | | Closes gh-6863.
* BUG, MAINT: Refactor ma.dot function and the corresponding method.Charles Harris2015-11-101-144/+2
| | | | | | | | | | | | | 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.
* STY: Minor style fixups.Charles Harris2015-11-071-1/+2
| | | | | Fix some long lines and indentation in numpy/ma/core.py and numpy/ma/extras.py
* BUG: scalar argument to ma.atleast_* return arraysJonathan Helmus2015-10-201-0/+4
| | | | | | | | | | | 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
* ENH: improve worst case of ma.clump_maskedJulian Taylor2015-10-081-18/+19
| | | | | | 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.
* DOC: typo: affectLars Buitinck2015-10-021-3/+3
|
* STY,MAINT: PEP8 and pyflakes fixes for numpy/ma/*.pyCharles Harris2015-07-041-54/+40
| | | | | | | | | | Also * Add __all__ to numpy/ma/testutils.py * Remove various stray "#" We might want to consider removing/refactoring both numpy/ma/bench.py and numpy/ma/timer_comparison.
* DOC: Fix docstring warnings in documetation generation.Charles Harris2015-07-011-3/+5
| | | | | | | | | | | | Most of these fixes involve putting blank lines around .. versionadded:: x.x.x and .. deprecated:: x.x.x Some of the examples were also fixed.
* MAINT: Mark deprecation warning with a date and Numpy version.Charles Harris2015-06-211-0/+1
| | | | | | This is to make it easier to find and remove deprecated features. It would be a good idea if all deprecations were made with similar comments.
* MANT: handling of axis in np.ma.compress_ndJaime Fernandez2015-05-171-16/+14
| | | | | | Modified the handling that np.ma.compress_nd does of its 'axis' argument, to more closely follow that of ufunc methods, including error messages for wrong values.
* BUG: setdiff1d return dtypeChristian Brodbeck2015-05-071-6/+4
| | | | | 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)
* ENH: Introduce np.ma.compress_nd(), generalizes np.ma.compress_rowcols()Daniel da Silva2015-05-031-22/+63
| | | | Provides a way to supress slices along an abitrary tuple of dimensions.
* BUG: Implemented MaskedArray.dotAlexander Belopolsky2015-03-221-7/+1
| | | | | | MaskedArray used to inherit ndarray.dot which ignored masks in the operands. Fixes issue #5185.
* ENH: deprecate bias and ddof arguments to corrcoefMatthew Brett2015-03-151-29/+25
| | | | | | | 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.
* DOC: Reconcile docstrings and function signatures where they disagreeRobert McGibbon2015-03-021-1/+5
| | | | | Fixed typos in docstrings were updated for functions where the parameter names in the docstring didn't match the function signature.
* BUG: numpy.ma.polyfit masks NaNs incorrectlySimon Gibbons2015-02-211-5/+5
| | | | | | | | | | 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
* Update docstring of ma.extras.average to reflect actual behaviorMatthew Craig2015-02-081-2/+3
|
* Merge pull request #5447 from juliantaylor/ma-median-ndarrayCharles Harris2015-01-131-2/+2
|\ | | | | BUG: fix ma.median used on ndarrays
| * BUG: fix ma.median used on ndarraysJulian Taylor2015-01-131-2/+2
| | | | | | | | | | | | 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
* | DOC: Added ma.clump_masked to doc; removed `extras` in examplesYuxiang Wang2014-12-281-16/+16
|/ | | | | 1. Added `ma.clump_masked` and `ma.clump_unmasked` into the rst file; 2. Removed the `.extras` in the examples due to the namespace change
* BUG: fix nanmedian on arrays containing infJulian Taylor2014-10-141-3/+10
| | | | | | | | | | | | | | | | | 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
* BUG: Make numpy import when run with Python flag '-OO'.Charles Harris2014-10-031-3/+5
| | | | | | | This consists of checking for a docstring equal to None and skipping two tests that require docstrings. Closes #5148.
* ENH: rewrite ma.median to improve poor performance for multiple dimensionsJulian Taylor2014-06-021-16/+25
| | | | | | | | | | | | | | | | 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.
* Merge pull request #4463 from abalkin/issue-4461Charles Harris2014-04-031-8/+35
|\ | | | | BUG: Masked arrays and apply_over_axes
| * BUG: Masked arrays and apply_over_axesLev Abalkin2014-04-011-8/+35
| | | | | | | | | | | | | | Masked arrays version of apply_over_axes did not apply function correctly to arrays with non-trivial masks. Fixes #4461.
* | Merge pull request #4045 from abalkin/gh-4043Charles Harris2014-03-261-2/+2
|\ \ | |/ |/| ENH: ma.asarray() and ma.asanyarray() will pass through input of the cor...