summaryrefslogtreecommitdiff
path: root/numpy/ma/tests/test_extras.py
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #7001 from shoyer/NaT-comparison"Charles Harris2016-01-161-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.
* TST, ENH: make all comparisons with NaT falseStephan Hoyer2016-01-141-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
* TST: Add tests for ma.dot.Charles Harris2015-11-101-19/+35
| | | | | Test that ma.dot always returns a masked array. Test basic that the new out parameter in ma.dot works.
* BUG: scalar argument to ma.atleast_* return arraysJonathan Helmus2015-10-201-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
* ENH: improve worst case of ma.clump_maskedJulian Taylor2015-10-081-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.
* STY,MAINT: Run pyflakes and pep8 on numpy/ma/tests/*.Charles Harris2015-07-251-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.
* BUG: setdiff1d return dtypeChristian Brodbeck2015-05-071-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)
* ENH: Introduce np.ma.compress_nd(), generalizes np.ma.compress_rowcols()Daniel da Silva2015-05-031-5/+117
| | | | Provides a way to supress slices along an abitrary tuple of dimensions.
* ENH: deprecate bias and ddof arguments to corrcoefMatthew Brett2015-03-151-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.
* BUG: numpy.ma.polyfit masks NaNs incorrectlySimon Gibbons2015-02-211-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
* BUG: fix ma.median used on ndarraysJulian Taylor2015-01-131-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
* BUG: fix nanmedian on arrays containing infJulian Taylor2014-10-141-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
* Merge pull request #4454 from jurnix/namedargsJulian Taylor2014-06-081-0/+10
|\ | | | | ENH: apply_along_axis accepts named arguments
| * ENH: apply_along_axis accepts named argumentsAlbert2014-03-271-0/+10
| |
* | ENH: rewrite ma.median to improve poor performance for multiple dimensionsJulian Taylor2014-06-021-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.
* | BUG: Masked arrays and apply_over_axesLev Abalkin2014-04-011-1/+2
|/ | | | | | | Masked arrays version of apply_over_axes did not apply function correctly to arrays with non-trivial masks. Fixes #4461.
* Convert docstrings to comments for nose; PEP8 cleanup (some tests activated)Marten van Kerkwijk2013-10-121-65/+65
|
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-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.
* BUG: ma: ma.average didn't handle complex arrays correctly (issue gh-2684)Warren Weckesser2013-06-151-2/+45
|
* MAINT: ma: clean up ma/test_extras.py: don't use 'import *'; PEP8 whitespaceWarren Weckesser2013-06-151-61/+67
|
* ENH: add `invert` parameter to numpy.in1d().Julien Phalip2013-04-081-0/+13
|
* 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.
* 2to3: Use absolute imports.Charles Harris2013-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+3
| | | | | | | | 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.
* TST: Add test for weight modification.Charles Harris2011-12-151-0/+2
|
* MAINT: Make masked ma.polyfit match current polyfit.Charles Harris2011-12-151-1/+9
|
* STY: Replace assert by assert_ in tests. There remain 124 uses ofCharles Harris2011-04-051-2/+2
| | | | assert in non-testing files that should be checked for correctness.
* fix (flat)notmasked_/contiguous/edges/pierregm2010-08-111-4/+13
|
* ma.extraspierregm2010-08-091-6/+20
| | | | * fixed the documentation of (flat)notmasked_xxx
* ENH: Add ddof keyword to masked versions of cov and corrcoef.Charles Harris2010-07-071-0/+6
|
* * Added `apply_over_axes` as requested in ticket #1480pierregm2010-05-161-211/+223
|
* DEP: Fix deprecation warnings in Python 3.1. The warnings come from the unittestCharles Harris2010-02-201-17/+17
| | | | | | | | | module. The fix should be good for Python >= 2.4 and used the following sed script: s/\<failUnless\>/assertTrue/g s/\<failIf\>/assertFalse/g s/\<failUnlessEqual\>/assertEqual/g s/\<failUnlessRaises\>/assertRaises/g
* * fixed np.ma.average on integersw/ mask (bug #1188)pierregm2009-08-061-24/+31
|
* Fix to setdiff1d (and masked version) + tests (#1133, by N.C.)Robert Cimrman2009-07-201-1/+1
|
* core : fixed MaskedArray.__array_finalize__ when the mask is full of False ↵pierregm2009-07-181-4/+27
| | | | | | (bugfix #1166) extras : introduced clump_masked and clump_unmasked
* Enhancements to arraysetops (ticket #1133, by Neil Crighton)Robert Cimrman2009-07-081-31/+25
|
* * fixed notmasked_edges when no data are maskedpierregm2009-04-131-14/+38
|
* * add intersect1d, intersect1d_nu, setdiff1d, setmember1d, setxor1d, ↵pierregm2009-01-191-43/+221
| | | | | | unique1d, union1d * use np.atleast1d instead of ma.atleast1d
* ran reindentJarrod Millman2008-12-311-2/+2
|
* * Fixed MaskedArray for nested dtype w/ input maskpierregm2008-12-021-0/+56
| | | | | * Fixed masked_all for nested dtype * Fixed masked_all_like for nested dtype
* replaced assert with self.failUnlesspierregm2008-09-291-14/+14
|
* median : fixed a bug in _median1D (there shouldn't have been an axis)pierregm2008-09-181-14/+25
|
* ran reindentJarrod Millman2008-08-081-7/+7
|
* * core : minor doc formattingpierregm2008-08-071-24/+26
| | | | * test_extras: switched to assert_almost_equal in TestCov and TestCorrcoef
* corepierregm2008-08-071-0/+56
| | | | | | | * use self.__name__ for private method instances extras * fixed corrcoef * introduced diagflat
* * added cov and corrcoef to ma.extras for compatibilitypierregm2008-08-051-1/+69
|
* Corrected a goof in .reshape()pierregm2008-07-021-2/+2
|
* Restore old test framework classes.Alan McIntyre2008-06-211-1/+1
| | | | | | | | | | | Added numpy.testing.run_module_suite to simplify "if __name__ == '__main__'" boilerplate code in test modules. Removed numpy/testing/pkgtester.py since it just consisted of an import statement after porting SciPy r4424. Allow numpy.*.test() to accept the old keyword arguments (but issue a deprecation warning when old arguments are seen). numpy.*.test() returns a test result object as before. Fixed typo in distutils doc.
* Switched to use nose to run tests. Added test and bench functions to all ↵Alan McIntyre2008-06-171-29/+20
| | | | modules.
* CHANGES:pierregm2008-06-081-43/+49
| | | | | | | | | | | | | | | | | | | core: * When creating a masked array with named fields, the mask has now a flexible type [(n,bool) for n in fields], which allows individual fields to be masked. * When a masked array has named fields, setting the mask to a sequence of booleans will set the mask of all the fields of the corresponding record. * A new property, recordmask, returns either the mask (when no named fields) or a boolean array where values are True if all the fields of one record are masked, False otherwise. * A new private attribute, _isfield, has been introduced to keep track whether an array is a field of a record-like masked array or not, and make sure that the mask is properly propagated. * Setting an existing mask to nomask will only fill the mask with False, not transform it to nomask mrecords: * _fieldmask is now only a synonym for _mask, kept for convenience * revamped __getattribute__ to the example of numpy.core.records.recarray.__getattribute__ * __setslice__ and filled are now inhertied from MaskedArray tests * The tests in test_core have been reorganized to improve clarity and avoid duplication. * test_extras now uses the convention "import numpy as np"