summaryrefslogtreecommitdiff
path: root/numpy/ma/extras.py
Commit message (Collapse)AuthorAgeFilesLines
* 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...
| * BUG: Fixed mask_rowcols().Lev Abalkin2013-11-141-2/+2
| | | | | | | | | | | | | | Previous implementation relied on ma.asarray() to always create a new object. See gh-4043.
* | DEP: Deprecate boolean `-` operationsSebastian Berg2014-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Boolean - is not well defined, especially the unary and binary operator are not compatible. In general boolean minus seems to have no real application and does not do what might be expected. All "allclose" type functions (numpy, tests, masked) have to now check for boolean to avoid the deprecation warning. In the future one could think about removing it again and just allowing the upcast.
* | DOC: Fix description of ma.average parameter.astaric2014-01-291-2/+2
|/ | | | Replace mention of variance in numpy.ma.average doc string with average.
* BUG: ma: ma.average didn't handle complex arrays correctly (issue gh-2684)Warren Weckesser2013-06-151-7/+7
|
* BUG: Correctly pass on ddof paramter on inside np.ma.corrcoefSebastian Berg2013-05-171-4/+3
| | | | | | While ddof has basically no effect on corrcoef, it exists, but it was not passed on correctly (instead only bias would be passed on). Fixes gh-3336
* MAINT: Apply 2to3 idioms fixer.Charles Harris2013-05-021-4/+4
| | | | | | | | | | | | | | | | | | | The idioms fixer makes the following replacements. 1) int <- bool 2) comparison or identity of types <- isinstance 3) a.sort() <- sorted(a) There were two problems that needed to be dealt with after the application of the fixer. First, the replacement of comparison or identity of types by isinstance was not always correct. The isinstance function returns true for subtypes whereas many of the places where the fixer made a substitution needed to check for exact type equality. Second, the sorted function was applied to arrays, but because it treats them as iterators and constructs a sorted list from the result, that is the wrong thing to do. Closes #3062.
* ENH: add `invert` parameter to numpy.in1d().Julien Phalip2013-04-081-3/+6
|
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* Merge pull request #460 from endolith/regex_formattingCharles Harris2013-04-031-1/+1
|\ | | | | DOC: Formatting fixes using regex
| * DOC: regex-assisted fixes of definition list formattingendolith2013-03-191-1/+1
| |
* | 2to3: Use absolute imports.Charles Harris2013-03-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172
* | 2to3: Replace xrange by range and use list(range(...)) where neededCharles Harris2013-03-271-2/+2
|/ | | | | | | | | | | | | | | In python3 range is an iterator and `xrange` has been removed. This has two consequence for code: 1) Where a list is needed `list(range(...))` must be used. 2) `xrange` must be replaced by `range` Both of these changes also work in python2 and this patch makes both. There are three places fixed that do not need it, but I left them in so that the result would be `xrange` clean. Closes #3092
* 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+2
| | | | | | | | This should be harmless, as we already are division clean. However, placement of this import takes some care. In the future a script can be used to append new features without worry, at least until such time as it exceeds a single line. Having that ability will make it easier to deal with absolute imports and printing updates.
* 2to3: Apply `raise` fixes. Closes #3077.Charles Harris2013-03-011-2/+2
| | | | | | | | | | Replaces the raise Exception, msg: form with raise Exception(msg):
* BUG: Handle weight correctly and don't modify the original.Charles Harris2011-12-151-8/+13
|
* MAINT: Make masked ma.polyfit match current polyfit.Charles Harris2011-12-151-27/+11
|
* ENH: missingdata: Implemented boolean assignment, working with NA masksMark Wiebe2011-08-271-1/+1
|
* STY: Update exception style, easy ones.Charles Harris2011-04-051-8/+8
|
* DEP: remove unique1d, setmember1d and intersect1d_nu.rgommers2011-03-111-5/+5
|
* fix (flat)notmasked_/contiguous/edges/pierregm2010-08-111-7/+19
|
* ma.extraspierregm2010-08-091-23/+32
| | | | * fixed the documentation of (flat)notmasked_xxx
* * fixed numpy.ma.extras.flatnotmasked_contiguous (bug #1576)pierregm2010-08-091-10/+8
|
* DEP: Remove ma.extras functions that were deprecated in 1.4.0.rgommers2010-08-051-53/+3
|
* ENH: Add ddof keyword to masked versions of cov and corrcoef.Charles Harris2010-07-071-8/+41
|