summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* ENH: lib: Rewrite vander: make it faster, and add an option to specify the ↵Warren Weckesser2013-11-021-1/+35
| | | | order of the powers (either decreasing or increasing).
* MAINT: Don't use 'import *' in lib/test_twodim_base.py.Warren Weckesser2013-11-021-1/+3
|
* MAINT: io: handle a bad fmt argument in savetxt by raising a ValueError.Warren Weckesser2013-10-201-0/+4
|
* BUG: cov/corrcoef complex input and empty arraysJoseph Martinot-Lagarde2013-10-161-5/+47
| | | | | | | | | | | | | | | | | This preserves the complex (and higher precision float or object) type of the input array, so that the complex covariance and correlation coefficients can be calculated. It also fixes the the behaviour of empty arrays. These will now either result in a 0x0 result, or a NxN result filled with NaNs. A warning is now issued when ddof is too large and the factor set to 0 so that in this case the result is always NaN or infinity/negative infinity and never a negative number. Closes gh-597 and gh-2680 Closes gh-3882 (original pull request)
* Merge pull request #3820 from juliantaylor/microoptCharles Harris2013-10-142-1/+2
|\ | | | | A couple micro optimizations
| * TST: improve test speedJulian Taylor2013-09-282-1/+2
| | | | | | | | | | | | | | move slow test_memmap_roundtrip to slow tests decrease excessively large array size used in np.sin(x) compuation TestInterp.test_if_len_x_is_small, the code has no special path for this large size differences.
* | TST: Raise AssertionError on failureJoseph Martinot-Lagarde2013-10-101-0/+2
| |
* | TST: Regression test for gh-2561Joseph Martinot-Lagarde2013-10-091-0/+14
| |
* | Merge pull request #3769 from juliantaylor/percentile-compatseberg2013-10-051-3/+134
|\ \ | | | | | | BUG: ensure percentile has same output structure as in 1.8
| * | BUG: ensure percentile has same output structure as in 1.8Julian Taylor2013-10-041-3/+134
| | | | | | | | | | | | | | | | | | percentile returned scalars and lists of arrays in 1.8 adapt new percentile to return scalar and arrays with q dimension first for compatibility.
* | | BUG: Refactor nanfunctions to behave as agreed on for 1.9.Charles Harris2013-10-041-66/+171
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deal with subclasses of ndarray, like pandas.Series and matrix. Subclasses may not define the new keyword keepdims or deal gracefully with ufuncs in all their forms. This is solved by throwing the problem onto the np.sum, np.any, etc. functions that have ugly hacks to deal with the problem. Settle handling of all-nan slices. nanmax, nanmin -- Raise warning, return NaN for slice. nanargmax, nanargmin -- Raise ValueError. nansum -- Return 0 for slice. nanmean, nanvar, nanstd -- Raise warning, return NaN for slice. Make NaN functions work for scalar arguments. This may seem silly, but it removes a check for special cases. Update tests Deal with new all-nan handling. Test with matrix class as example of subclass without keepdims. Test with scalar arguments. Fix nanvar issue reported in #3860. Closes #3860 #3850
* | BUG: preserve ndarray subclasses in medianJulian Taylor2013-10-021-0/+13
| | | | | | | | closes gh-3846
* | DEP, MAINT: Remove references to numeric and numarray.Charles Harris2013-09-231-4/+4
|/ | | | | This covers those locations that either import or build numarray or numeric.
* TST: note on overwrite_input parameter in percentileJonathan Helmus2013-09-161-0/+10
| | | | | | | * added note that `overwrite_input` has not effect when `a` is not an array in the percentile function. * added unit test to verify that no error is raised when `a` is not an array and `overwrite_input` is True.
* MAINT: changed 'closest' interpolation to 'nearest'Jonathan Helmus2013-09-161-3/+3
|
* TST: additional test for percentileJonathan Helmus2013-09-131-0/+3
|
* MAINT: cleaning up percentile function.Jonathan Helmus2013-09-131-39/+10
|
* ENH: percentile function with additional parameters and vecorizationJonathan Helmus2013-09-131-20/+117
| | | | | | | The percentile function was enhanced by adding limit and interpolation parameters to give it similar functionality to SciPy's stats.scoreatpercentile function. In addition the function was vecorized along q and rewritten to use the partition method for better performance.
* BUG: Fix 0-sized ndindexSebastian Berg2013-09-091-0/+4
| | | | | | | The zerosize_ok flag to nditer was missing, so that it did not allow for 0-sized iteration. Closes gh-3714
* TST: add test for Python 3.4 _ast.NameConstantChristoph Gohlke2013-09-081-0/+4
|
* ENH: Improve accuracy of numpy.gradient at edgesdanieljfarrell2013-09-071-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * numpy.gradient has been enhanced to use a second order accurate one-sided finite difference stencil at boundary elements of the array. Second order accurate central difference are still used for the interior elements. The result is a fully second order accurate approximation of the gradient over the full domain. * The one-sided stencil uses 3 elements each with a different weight. A forward difference is used for the first element, dy/dx ~ -(3.0*y[0] - 4.0*y[1] + y[2]) / (2.0*dx) and backwards difference is used for the last element, dy/dx ~ (3.0*y[-1] - 4.0*y[-2] + y[-3]) / (2.0*dx) * Because the datetime64 datatype cannot be multiplied a view is taken of datetime64 arrays and cast to int64. The gradient algorithm is then applied to the view rather than the input array. * Previously no dimension checks were performed on the input array. Now if the array size along the differentiation axis is less than 2, a ValueError is raised which explains that more elements are needed. If the size is exactly two the function falls back to using a 2 point stencil (the old behaviour). If the size is 3 and above then the higher accuracy methods are used. * A new test has been added which validates the higher accuracy. Old tests have been updated to pass. Note, this should be expected because the boundary elements now return different (more accurate) values.
* STY: Make numpy/lib/test/*.py PEP8 compliant.Charles Harris2013-09-0319-1086/+1246
| | | | | | | Run autopep8 over the test files in numpy/lib/test and make fixes to the result. Also remove Python5 workaround.
* BUG: Make DeprecationWarning always raise error in test.Charles Harris2013-08-311-3/+5
| | | | | | The test_fancy in numpy/lib/tests/test_function_base.py failed in release because a DeprecationWarning was no longer raised, it had become a warning.
* DEP: Make nansum return 0 for all-NaN or empty axis.Charles Harris2013-08-181-27/+11
| | | | | Make this happen and remove test parts dependent on numpy version < 1.9. Fixes test failures in numpy after 1.8 branch.
* STY: Giant comma spacing fixup.Charles Harris2013-08-1815-717/+717
| | | | | | | 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.
* STY: Giant whitespace cleanup.Charles Harris2013-08-181-1/+1
| | | | Now is as good a time as any with open PR's at a low.
* BUG: fix np.median so it accepts array_like input. Clean up median tests.Ralf Gommers2013-08-171-56/+73
|
* TST: Test that savetxt works with objects having a write method.Daniel2013-08-151-0/+12
|
* DOC: Various fixes.Charles Harris2013-08-141-4/+4
| | | | | | Fix typos and clarify some explanations. Document the changes in the return values of nanargmin and nanargmax for all-NaN slices in the 1.8.0 release notes.
* TST: Add tests for the nansum, nanmean, nanvar, and nanstd.Charles Harris2013-08-121-190/+367
|
* MAINT: Separate nan functions into their own module.Charles Harris2013-08-122-128/+245
| | | | | | | | | | | | | | New files lib/nanfunctions.py and lib/tests/test_nanfunctions.py are added and both the previous and new nan functions and tests are moved into them. The existing nan functions moved from lib/function_base are: nansum, nanmin, nanmax, nanargmin, nanargmax The added nan functions moved from core/numeric are: nanmean, nanvar, nanstd
* ENH: implement median in terms of partitionJulian Taylor2013-08-121-0/+47
| | | | | | Partitioning is sufficient to obtain the median and is much faster. In the case of overwrite_input=True the resulting array will not be fully sorted anymore.
* BUG: Make np.insert check for out of bounds axis arguments.Félix Hartmann2013-08-021-0/+4
| | | | Also add test for IndexError exception when axis is out of bounds.
* TST: add test for negative axis values in np.insert.Félix Hartmann2013-08-021-0/+7
|
* MAINT: Remove uses of the WarningManager class.Charles Harris2013-07-121-26/+10
| | | | | | | | | | | | WarningManager was a workaround for the lack of the with statement in Python versions < 2.6. As those versions are no longer supported it can be removed. Deprecation notes are added to WarningManager and WarningMessage, but to avoid a cascade of messages in third party apps, no warnings are raised at this time, that can be done later. Closes #3519.
* MAINT: Use np.errstate context manager.Charles Harris2013-07-112-79/+25
| | | | | | | | | | | | | Now that Python < 2.6 is no longer supported we can use the errstate context manager in places where constructs like ``` old = seterr(invalid='ignore') try: blah finally: seterr(**old) ``` were used.
* TST: New test to ensure np.pad allows pad_width of zero.Jostein Bø Fløystad2013-07-051-0/+8
|
* BUG: Make np.load transfer file ownership to the returned NpzFile.Charles Harris2013-06-221-1/+13
| | | | | | | This assures that when the loaded file is closed it also closes the file descriptor, avoiding a resource warning in Python3. Closes #3457.
* adjust the optimal IO buffer size for npz filesBartosz Telenczuk2013-06-121-5/+3
|
* BUG: fix loading large npz files (fixes #2922)Bartosz Telenczuk2013-06-121-1/+18
|
* BUG: The npv function in financial.py was incorrectly implemented.bebert2182013-05-291-1/+1
| | | | | | | | | | | | | Correct the implementation of the npv function, its documentation, and the mirr function that depends on it. The test_financial.py is also corrected to take into account those modifications The npv function behavior was contrary to what the documentation stated as it summed indexes 1 to M instead of 0 to M-1. The mirr function used a corrective factor to get the correct result in spite of that error so that factor is removed. Closes #649
* ENH: implement may_share_memory in CJulian Taylor2013-05-281-0/+15
| | | | | | | | | memmap needs to call it in __array_finalize__ to determine if it can drop the references on copies. The python version if may_share_memory caused significant slowdowns when slicing these maps. closes gh-3364
* ENH: improved, faster algorithm for array paddingJosh Warner (Mac)2013-05-191-15/+15
| | | | | | | | | | | | New padding method which scales much better with dimensionality. This new implementation is fully vectorized, builds each abstracted n-dimensional padding block in a single step, and takes advantage of separability. The API is completely preserved, and the old algorithm is used if a vector function is input for `mode`. The new algorithm is faster for all tested combinations of inputs, and scales much better with dimensionality. Execution time reductions from ~25% for small rank 1 arrays to >99% for rank 4+ arrays observed.
* Merge pull request #3280 from seberg/issue-3279seberg2013-04-271-0/+4
|\ | | | | BUG: np.insert must copy index array
| * BUG: np.insert must copy index arraySebastian Berg2013-04-271-0/+4
| | | | | | | | Otherwise it would do in-place changes to it. Fixes gh-3279.
* | 2to3: Apply unicode fixer.Charles Harris2013-04-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unicode fixer strips the u from u'hi' and converts the unicode type to str. The first won't work for Python 2 and instead we replace the u prefix with the sixu function borrowed from the six compatibility package. That function calls the unicode constructor with the 'unicode_escape' encoder so that the many tests using escaped unicode characters like u'\u0900' will be handled correctly. That makes the sixu function a bit different from the asunicode function currently in numpy.compat and also provides a target that can be converted back to the u prefix when support for Python 3.2 is dropped. Python 3.3 reintroduced the u prefix for compatibility. The unicode fixer also replaces 'unicode' with 'str' as 'unicode' is no longer a builtin in Python 3. For code compatibility, 'unicode' is defined either as 'str' or 'unicode' in numpy.compat so that checks like if isinstance(x, unicode): ... will work properly for all python versions. Closes #3089.
* | 2to3: Apply urllib fixer.Charles Harris2013-04-141-6/+10
| | | | | | | | | | | | | | | | | | | | | | Various functions have been moved around in the stdlib for Python 3, this fixes that up so that the code is valid in both Python 2 and Python 3. Note: monkey patching the stlib urlopen for testing looks a bit hokey to me, but I don't see an easier, more reliable way to do the test. Closes #3090.
* | 2to3: Apply zip fixer.Charles Harris2013-04-133-16/+16
| | | | | | | | | | | | | | | | | | | | In Python 3 zip returns an iterator instead of a list. Consequently, in places where an iterator won't do it must be enclosed in list(...). Lists instead of iterators are also used in array constructors as using iterators there usually results in an object array containing an iterator object. Closes #3094
* | 2to3: Apply the `numliterals` fixer and skip the `long` fixer.Charles Harris2013-04-134-6/+7
|/ | | | | | | | | | | | | | | | | | | The numliterals fixer replaces the old style octal number like '01' by '0o1' removes the 'L' suffix. Octal values were previously mistakenly specified in some dates, those uses have been corrected by removing the leading zeros. Simply Removing the 'L' suffix should not be a problem, but in some testing code it looks neccesary, so in those places the Python long constructor is used instead. The 'long' type is no longer defined in Python 3. Because we need to have it defined for Python 2 it is added to numpy/compat/np3k.py where it is defined as 'int' for Python 3 and 'long' for Python 2. The `long` fixer then needs to be skipped so that it doesn't undo the good work. Closes #3074, #3067.
* MAINT: np.delete keep old out of bound/negative index behaviorSebastian Berg2013-04-111-10/+13
|