summaryrefslogtreecommitdiff
path: root/numpy/lib
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | | | | Merge pull request #12594 from mattip/pypy3-testingTyler Reddy2019-04-221-1/+2
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | DEV, BUILD: add pypy3 to azure CI
| | | * | | | | | TEST: update for PyPymattip2019-04-171-1/+2
| | | | | | | | |
| | * | | | | | | DOC: Specify range for numpy.anglekritisingh12019-04-211-2/+2
| | | | | | | | |
| | * | | | | | | Merge pull request #11684 from mattip/unravel_index-emptyMatti Picus2019-04-181-0/+20
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | BUG: Raise when unravel_index, ravel_multi_index are given empty input
| | | * | | | | | | BUG: raise on empty sequence input to unravel_index, ravel_index_multi; ↵mattip2019-03-291-0/+20
| | | | |_|/ / / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | clarify error msg
| | * | | | | | | Merge pull request #12889 from ivanov/no-pickles-for-youCharles Harris2019-04-164-15/+29
| | |\ \ \ \ \ \ \ | | | |_|/ / / / / | | |/| | | | | | BUG: Make allow_pickle=False the default for loading
| | | * | | | | | BUG: load fails when using pickle without allow_pickle=TruePaul Ivanov2019-04-164-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a partial mitigation of #12759. see also https://nvd.nist.gov/vuln/detail/CVE-2019-6446
| | * | | | | | | Merge branch 'master' into poly1d-fixes-fixes-fixes-fixesEric Wieser2019-04-1650-5894/+11569
| | |\ \ \ \ \ \ \ | | | |/ / / / / /
| | | * | | | | | Merge pull request #13331 from rgommers/fix-docsMatti Picus2019-04-152-38/+45
| | | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | DOC, BLD: fix doc build issues in preparation for the next numpydoc release
| | | | * | | | | | DOC: fix doc build warnings in a cleaner way.Ralf Gommers2019-04-151-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Addresses review comment by @eric-wieser.
| | | | * | | | | | DOC: fix 4 remaining doc build warnings.Ralf Gommers2019-04-142-33/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2 for polyfit rankwarning, 2 for divide by zero in log10.
| | | | * | | | | | DOC: fix some more See Also issuesRalf Gommers2019-04-141-5/+4
| | | | | |/ / / / | | | | |/| | | | | | | | | | | | | | | | | | | | | | These ones just generated warnings, not build failures
| | | * | | | | | Merge pull request #13312 from eric-wieser/genfromtxt-closeTyler Reddy2019-04-152-270/+284
| | | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | BUG: Close files if an error occurs in genfromtxt
| | | | * | | | | | TST: unit test for gh-13200Tyler Reddy2019-04-131-1/+14
| | | | | | | | | |
| | | | * | | | | | BUG: Close files if an error occurs in genfromtxtEric Wieser2019-04-121-269/+270
| | | | |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly indentation changes Fixes gh-13200
| | | * | | | | | DOC: Added anti-diagonal examples to np.diagonal and np.fill_diagonalAnder Ustarroz2019-04-131-3/+20
| | | |/ / / / /
| | | * | | | | TST: fix up test_structured_paddedTyler Reddy2019-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * minor reviewer adjustments in PR 13301: in test_structured_padded it is necessary to perform the seek after writing to the file, and to specify a fmt option to match the expected result
| | | * | | | | BUG: Fix crash when calling savetxt on a padded arrayEric Wieser2019-04-112-2/+12
| | | | |_|_|/ | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a general rule, _every_ use of `.descr` is broken. Fixes #13297
| | | * | | | update testskikocorreoso2019-04-091-9/+7
| | | | | | |
| | | * | | | fix test namekikocorreoso2019-04-091-1/+1
| | | | | | |
| | | * | | | address comments on #9355kikocorreoso2019-03-302-9/+79
| | | |/ / /
| | | * | | DOC: correction to numpy.pad docstring (#13149)Gregory R. Lee2019-03-252-6/+3
| | | | | | | | | | | | | | | | | | * DOC: fix mistatement in numpy.pad docstring
| | | * | | MAINT: Rewrite numpy.pad without concatenate (gh-11358)Lars Grueter2019-03-252-965/+585
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: Add support for constant, edge, linear_ramp to new numpy.pad Passes unit tests: - TestConstant - TestEdge - TestZeroPadWidth - TestLegacyVectorFunction - TestNdarrayPadWidth - TestUnicodeInput - TestLinearRamp * MAINT: Simplify diff / change order of functions * MAINT: Revert to old handling of keyword-only arguments * ENH: Add support for stat modes * ENH: Add support for "reflect" mode * MAINT: Remove _slice_column * ENH: Add support for "symmetric" mode * MAINT: Simplify mode "linear_ramp" Creating the linear ramp as an array with 1-sized dimensions except for the one given by `axis` allows implicit broadcasting to the needed shape. This seems to be even a little bit faster that doing this by hand and allows the simplicifaction of the algorithm. Note: Profiling and optimization will be done again at a later stage. * MAINT: Reorder arguments of a sum and fix typo Addresses feedback raised in PR. * ENH: Add support for "wrap" mode This completes the first draft of the complete rewrite meaning all unit tests should pass from this commit onwards. * MAINT: Merge functions for "reflect" and "symmetric" mode The set functions were nearly the same, apart from some index offsets. Merging them reduces code duplication. * TST: Add regression test for gh-11216 The rewrite in past commits fixed this bug. * BUG: Fix edge case for _set_wrap_both when pad_amt contains 0. And include test to protect against regression. * MAINT: Simplify and optimize pad modes Major changes & goals: Don't deal with pad area in the front and back separately. This modularity isn't needed and makes handling of the right edge more awkward. All modes now deal with the left and right side at the same time. Move the creation of the linear ramps fully to its own function which behaves like a vectorized version of linspace. Separate calculation and application of the pad area where possible. This means that _get_edges can be reused for _get_linear_ramps. Combine _normalize_shape and _validate_lengths in a single function which should handles common cases faster. Add new mode "empty" which leaves the padded areas undefined. Add documentation where it was missing. * TST: Don't use np.empty in unit tests * MAINT: Reorder workflow in numpy.pad and deal with empty dimensions Only modes "constant" and "empty" can extend dimensions of size 0. Deal with this edge case gracefully for all other modes either fail or return empty array with padded non-zero dimensions. Handle default values closer to their actual usage. And validate keyword arguments that must be numbers. * MAINT: Add small tweaks to control flow and documentation * BUG: Ensure wrap mode works if right_pad is 0 * ENH: Use reduced region of interest for iterative padding When padding multiple dimensions iteratively corner values are unnecessarily overwritten multiple times. This function reduces the working area for the first dimensions so that corners are excluded. * MAINT: Restore original argument order in _slice_at_axis * MAINT: Keep original error message of broadcast_to * MAINT: Restore old behavior for non-number end_values. * BENCH: Make the pad benchmark pagefault in setup * ENH/TST: Preserve memory layout (order) of the input array and add appropriate unit test. * STY: Revert cosmetical changes to reduce diff * MAINT: Pin dtype to float64 for np.pad's benchmarks * MAINT: Remove redundant code path in _view_roi * MAINT/TST: Provide proper error message for unsupported modes and add appropriate unit test. * STY: Keep docstrings consistent and fix typo. * MAINT: Simplify logical workflow in pad * MAINT: Remove dtype argument from _linear_ramp The responsibility of rounding (but without type conversion) is not really need in _linear_ramp and only makes it a little bit harder to reason about. * DOC: Add version tag to new argument "empty" * MAINT: Default to C-order for padded arrays unless the input is F-contiguous. * MAINT: Name slice of original area consistently for all arguments describing the same thing. * STY: Reduce vertical space * MAINT: Remove shape argument from _slice_at_axis Simplifies calls to this function and the function itself. Using `(...,)` instead should keep this unambiguous. This change is not compatible with Python 2.7 which doesn't support this syntax outside sequence slicing. If that is wanted one could use `(Ellipsis,)` instead. * TST: Test if end_values of linear_ramp are exact which was not given in the old implementation `_arange_ndarray`. * DOC: Improve comments and wrap long line * MAINT: Refactor index_pair to width_pair Calling the right value an index is just plain wrong as it can't be used as such. * MAINT: Make _linear_ramp compatible with size=0 * MAINT: Don't rely on negative indices for slicing Calculating the proper positive index of the start of the right pad area makes it possible to omit the extra code paths for a width of 0. This should make the code easier to reason about. * MAINT: Skip calculation of right_stat if identical If the input area for both sides is the same we don't need to calculate it twice. * TST: Adapt tests from gh-12789 to rewrite of pad * TST: Add tests for mode "empty" * TST: Test dtype persistence for all modes * TST: Test exception for unsupported modes * TST: Test repeated wrapping for each side individually. Reaches some only partially covered if-statments in _set_wrap_both. * TST: Test padding of empty dimension with constant * TST: Test if end_values of linear_ramp are exact which was not given in the old implementation `_arange_ndarray`. (Was accidentally overwritten during the last merge). * TST: Test persistence of memory layout Adapted from an older commit 3ac4d2a1b9b258d65f8d2b5f8f25f88e3a0e8f58 which was accidentally overwritten during the last merge. * MAINT: Simplify branching in _set_reflect_both Reduce branching and try to make the calculation of the various indices easier to understand. * TST: Parametrize TestConditionalShortcuts class * TST: Test empty dimension padding for all modes * TST: Keep test parametrization ordered Keep parametrization ordered, otherwise pytest-xdist might believe that different tests were collected during parallelization causing test failures. * DOC: Describe performance improvement of np.pad as well as the new mode "empty" in release notes (see gh-11358). * DOC: Remove outdated / misleading notes These notes are badly worded or actually misleading. For a better explanation on how these functions work have a look at the context and comments just above the lines calling these functions.
| | | * | | Merge pull request #13117 from kshyatt/ksh/padMatti Picus2019-03-191-8/+8
| | | |\ \ \ | | | | | | | | | | | | | | DOC: Fix arg type for np.pad, fix #9489
| | | | * | | Update parameter description for constant and end valuesKatharine Hyatt2019-03-141-6/+6
| | | | | | |
| | | | * | | DOC: fix arg type for np.pad, fix #9489Katharine Hyatt2019-03-131-2/+2
| | | | | | |
| | | * | | | DEV: cleanup imports and some assignments (from LGTM)mattip2019-03-172-5/+1
| | | | | | |
| | | * | | | Fix array dispatcherStefan van der Walt2019-03-152-2/+2
| | | | | | |
| | | * | | | ENH: Make `mode` parameter default to `constant` (padding by zero)Stefan van der Walt2019-03-132-7/+6
| | | |/ / /
| | | * | | Merge pull request #8131 from wrwrwr/deprecate-formattingMatti Picus2019-03-102-0/+75
| | | |\ \ \ | | | | | | | | | | | | | | BUG: Fix help() formatting for deprecated functions.
| | | | * | | BUG: Fix help() formatting for deprecated functions.wrwrwr2019-02-172-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #8058.
| | | * | | | BUG: Fix errors in string formatting while producing an errorEric Wieser2019-03-021-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `"Invalid version %r" % (1, 2)` would fail with `TypeError: not all arguments converted during string formatting` The `Header is not a dictionary` error had a similar problem. Fixed by changing this entire function to use `.format` in place of `%`, which does not have this gotcha. Found using LGTM.com
| | | * | | | DOC: revert #13058 and fix Makefilemattip2019-03-011-3/+3
| | | | | | |
| | | * | | | DOC: Update interp docstringeuronion2019-02-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding 'strictly' to make the conditions to be met by the `xp` argument even more clear. Following the suggestion in https://github.com/numpy/numpy/issues/10448#issuecomment-468302058 .
| | | * | | | Merge pull request #10855 from madphysicist/unpack-countSebastian Berg2019-02-251-0/+63
| | | |\ \ \ \ | | | | | | | | | | | | | | | | ENH: Adding a count parameter to np.unpackbits
| | | | * | | | ENH: Added count parameter to unpackbitsJoseph Fox-Rabinovitz2019-02-251-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests are included. Couple of minor fixes: - Fixed packbits/unpackbits docs to reflect proper keyword names - Added .pytest_cache to .gitignore
| | | * | | | | Merge pull request #12989 from eric-wieser/inter-inf-alternativeSebastian Berg2019-02-251-1/+70
| | | |\ \ \ \ \ | | | | |/ / / / | | | |/| | | | ENH: Correct handling of infinities in np.interp (option B)
| | | | * | | | ENH: Improve handling of infinities in np.interpEric Wieser2019-02-241-1/+70
| | | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alternative to gh-12978, using a method that does not need a lot of special cases. This is likely more robust in the face of overflow Fixes gh-12951.
| | | * | | | MAINT: Move pickle import to numpy.compatCharles Harris2019-02-212-4/+2
| | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pickle module was being imported from numpy.core.numeric. It was defined there in order to use pickle5 when available in Python3 and cpickle in Python2. The numpy.compat module seems a better place for that.
| | | * | | Merge pull request #12965 from Carreau/ogrid-docMatti Picus2019-02-171-2/+3
| | | |\ \ \ | | | | | | | | | | | | | | DOC: Properly format Return section of ogrid Docstring,
| | | | * | | avoid using math.Matthias Bussonnier2019-02-131-1/+1
| | | | | | |
| | | | * | | Properly format Return section of ogrid Docstring,Matthias Bussonnier2019-02-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the newline and indent, the markup is not interpreted. Note that in the see-also `np.lib.index_tricks.nd_grid` is reference but not linked as it appear to not be autogenerated, but this is another issue.
| | | * | | | TST: Improve and refactor tests for numpy.padLars Grueter2019-02-141-223/+224
| | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * TST: Move test for negative stat_length and extend coverage to all modes and more variations of a negative stat_length. * TST: Merge tests for pad_width in single class * TST: Test behavior of pad's kwargs for all modes * TST: Move test to TestReflect Can be grouped with already existing test class checking the behavior for the reflect mode. * TST: Simplify regression test for object input * TST: Move testing pad_width as ndarray Can be grouped in class TestPadWidth as this test checks if an ndarray is accepted as the value to pad_width * TST: Remove faulty tests for pad_width's type These test were ineffective. The TypeError raised in these test was not actually due to pad_width receiving the wrong type but due to the missing parameter mode. Added missing type complex to the appropriate existing test checking for pad_widths type behavior. * TST: Move test for pad_width of zero * TST: Move test for simple stat_length * TST: Simplify classes with only one test * TST: Add naive test for non-contiguous arrays * MAINT: Don't import pad directly Using np.pad instead of directly importing the function seems to be more inline with other test modules. * STY: Make class layout consistent in module * TST: Fix match-string for missing pad mode error The CLI fails due to error message containing a reference to _pad_dispatcher() being returned instead of pad(). For some reason this test passes when run locally.
| | | * | | DOC: Add warning about arbitrary code execution to numpy.loadAndras Deak2019-02-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Load uses pickle under the hood for object arrays, this is made more visible in the documentation using a warning. See also gh-12759
| | | * | | Merge pull request #12818 from mattip/doc-warningsMatti Picus2019-01-231-1/+3
| | | |\ \ \ | | | | | | | | | | | | | | DOC: remove python2-only methods, small cleanups
| | | | * | | DOC: fixes from reviewmattip2019-01-221-0/+1
| | | | | | |
| | | | * | | DOC: remove python2-only methods, small cleanupsmattip2019-01-211-1/+2
| | | | | | |
| | | * | | | ENH: __array_function__ updates for NumPy 1.17.0Stephan Hoyer2019-01-222-9/+2
| | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Always enable __array_function__ overrides. - Remove special cases for Python 2 compatibility. - Document these changes in 1.17.0-notes.rst. It will be good to see ASV numbers to understand the performance implications of these changes. If need be, we can speed up NumPy functions internally by using non-dispatched functions (with ``.__wrapped__``).
| | | * | | ENH: add _nan_mask functionTyler Reddy2019-01-182-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add _nan_mask function and associated unit tests; this function is to be used to simplify reduction operations involving np.nan elements by using a mask with a ``where`` argument
| | | * | | Merge pull request #12762 from EelcoPeacs/local_datasource_firstCharles Harris2019-01-171-4/+5
| | | |\ \ \ | | | | | | | | | | | | | | MAINT: Change the order of checking for locale file and import urllib modules