summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* BUG: nanpercentile/nanmedian 0-d with output given.Sebastian Berg2014-05-281-40/+71
| | | | Also some PEP-8 fixes and test improvements
* ENH: added functionality nanpercentile to numpyDavid Freese2014-05-221-0/+90
| | | | | | Implemented a nanpercentile and associated tests as an extension of np.percentile to complement the other nanfunctions.
* ENH: Add the scipy NumpyVersion class.Charles Harris2014-05-151-0/+57
| | | | | The class is in numpy/lib/_version.py and can be used to compare numpy versions when the version goes to double digits.
* ENH: added functionality nanmedian to numpyDavid Freese2014-05-021-4/+94
| | | | | | | | | | Implemented a nanmedian and associated tests as an extension of np.median to complement the other nanfunctions Added negative values to the unit tests Cleaned up documentation of nanmedian
* Add tests using matricesMarten van Kerkwijk2014-04-221-0/+25
|
* ENH: add a 'return_counts=' keyword argument to `np.unique`jaimefrio2014-04-051-11/+39
| | | | | | | | | | | | | | | | This PR adds a new keyword argument to `np.unique` that returns the number of times each unique item comes up in the array. This allows replacing a typical numpy construct: unq, _ = np.unique(a, return_inverse=True) unq_counts = np.bincount(_) with a single line of code: unq, unq_counts = np.unique(a, return_counts=True) As a plus, it runs faster, because it does not need the extra operations required to produce `unique_inverse`.
* ENH: Better error w/ line num for bad column count in np.loadtxt()Daniel da Silva2014-04-051-2/+13
| | | | Resolves #2591. Adds more explicit error handling in line parsing loop.
* Merge pull request #3830 from jarondl/recfromcsvCharles Harris2014-03-281-0/+8
|\ | | | | MAINT (API?): organize npyio.recfromcsv defaults
| * TST: Added regression test for recfromcsv dtype error, as suggested by @hpauljYaron de Leeuw2014-02-281-0/+8
| |
* | Merge pull request #4542 from immerrr/fix-bincount-systemerrorCharles Harris2014-03-261-1/+18
|\ \ | | | | | | BUG: fix some errors raised when minlength is incorrect in np.bincount
| * | BUG: fix incorrect minlength handling in np.bincountimmerrr2014-03-261-1/+18
| | |
* | | Merge pull request #4509 from jaimefrio/twodim-speedupJulian Taylor2014-03-261-5/+39
|\ \ \ | |/ / |/| | ENH: speed-up of triangular matrix functions
| * | ENH: speed-up of triangular matrix functionsjaimefrio2014-03-251-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * `np.tri` now produces less intermediate arrays. Runs about 40% faster for general dtypes, up to 3x faster for boolean arrays. * `np.tril` now does smarter type conversions (thanks Julian!), and together with the improvements in `np.tri` now runs about 30% faster. `np.triu` runs almost 2x faster than before, but still runs 20% slower than `np.tril`, which is an improvement over the 50% difference before. * `np.triu_indices` and `np.tril_indices` do not call `np.mask_indices`, instead they call `np.where` directly on a boolean array created with `np.tri`. They now run roughly 2x faster. * Removed the constraint for the array to be square in calls to `np.triu_indices`, `np.tril_indices`, `np.triu_indices_from` and `np.tril_indices_from`.
* | | Merge pull request #4358 from seberg/fast-selectCharles Harris2014-03-241-6/+57
|\ \ \ | | | | | | | | ENH: Speed improvements and deprecations for np.select
| * | | ENH: Speed improvements and deprecations for np.selectSebastian Berg2014-03-231-6/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea for this (and some of the code) originally comes from Graeme B Bell (gh-3537). Choose is not as fast and pretty limited, so an iterative copyto is used instead. Closes gh-3259, gh-3537, gh-3551, and gh-3254
* | | | TST: add unittest for byte_boundsOlivier Grisel2014-03-191-0/+9
| | | |
* | | | TST: add some more testsJulian Taylor2014-03-171-0/+10
| |/ / |/| | | | | | | | | | | test for gh-4494 test median returns array scalars and works with object arrays
* | | MAINT: revert back to separate median implementationJulian Taylor2014-03-131-0/+14
| | | | | | | | | | | | | | | | | | Merging median and percentile make would break astropy and quantities as we don't call mean anymore. These packages rely on overriding mean to add their own median behavior.
* | | ENH: add extended axis and keepdims support to median and percentileJulian Taylor2014-03-131-17/+118
| | |
* | | remove assert in _get_ufunc_and_otypes, add a test in test_function_base.pyLeoMao2014-03-121-0/+6
|/ /
* | Merge pull request #4377 from ContinuumIO/as_strided_fixCharles Harris2014-03-011-0/+17
|\ \ | | | | | | Fix stride_stricks.as_strided function for object arrays
| * | Fix stride_stricks.as_strided function for object arraysJay Bourque2014-02-261-0/+17
| |/ | | | | | | Currently, calling as_strided for object array results in 'TypeError: Cannot change data-type for object array.'. Fix so that dtype of new array is only set for void dtype, as originally intended.
* | Merge pull request #4284 from robquant/histogramdd_rightmost_binedgeJulian Taylor2014-03-011-0/+24
|\ \ | | | | | | Closes issue #4266, fixes histogramdd treatment of events at rightmost binedge
| * | Fix histogramdd treatment of events at rightmost binedgeRobert Franke2014-02-121-0/+24
| | | | | | | | | | | | Fixes Github issue #4266
* | | BUG: accept non arrays in cor and corrcoeffJulian Taylor2014-02-271-0/+4
| |/ |/| | | | | closes gh-4295
* | Merge pull request #4302 from charris/fix-gh-605seberg2014-02-261-0/+2
|\ \ | | | | | | BUG: Make interp return NaN at NaN interpolation points.
| * | BUG: Make interp return NaN at NaN interpolation points.Charles Harris2014-02-161-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | A NaN interpolation point was interpreted as out of bounds on the left side, hence the value of the left parameter in the function call was returned. >>> np.interp(np.nan, [-10, 10], [-2, 2]) -2.0 NaN is a better choice. Closes #605.
* | ENH: tril and triu broadcastingalex2014-02-241-5/+29
| |
* | BUG: Fixes #2799jaimefrio2014-02-211-0/+4
| | | | | | | | | | Use `np.sort` instead of `sorted` when the input is a list and no indices are requested. Fixes #2799.
* | TST: do not use "ignore" to filter warningsSebastian Berg2014-02-212-10/+10
|/ | | | | | | | | | | | | | | | | When a warning is ignored (or raised once) in python, the warnings module will tag on a `__warningregistry__` dictionary to be able to filter these warnings in the future. This is tagged on to the current context, causing leakage to later calls (this is a bit more complex, since where the registry ends up depends on the layers between the original caller and warner). In short, tests should typically not use ignore but catch the warnings to avoid changing the user experience (or errors on duplicate test runs). Fixes an error on duplicate test runs (does not remove all "ignores" which may change behaviour outside tests). Closes gh-4340
* Merge pull request #4247 from jaimefrio/digitize-monotonicCharles Harris2014-02-111-0/+16
|\ | | | | BUG: check for monotonic bin arrays in digitize
| * STY: adapted code to `C_STYLE_GUIDE.rst.txt`.jaimefrio2014-02-091-5/+8
| | | | | | | | | | | | MAINT: rewrote `check_array_monotonic` to use array indices, not pointers. TST: tests for proper handling of bins with all items almost equal now check the return value for correctness, not just that an error is not raised.
| * BUG: check for monotonic bin arrays in digitizejaimefrio2014-01-301-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for monotonic bin arrays of digitize doesn't properly handle inputs with repeated entries at the beginning of the array: ``` >>> np.__version__ '1.8.0' >>> np.digitize([1], [0, 0 , 2]) array([2], dtype=int64) >>> np.digitize([1], [2, 2, 0]) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: The bins must be monotonically increasing or decreasing ``` Modified `check_array_monotonic` in `_compiled_base.c` to skip over repeating entries before deciding to check for increasing or decreasing monotonicity and added relevant tests to `test_function_base.py`.
* | Merge pull request #3798 from seberg/new-index-machineryCharles Harris2014-02-091-1/+1
|\ \ | | | | | | ENH: Reimplementing the indexing machinery
| * | ENH: Attempt to rewrite the index parsing.Sebastian Berg2014-02-061-1/+1
| | | | | | | | | | | | Some optimizations still missing.
* | | Merge pull request #4273 from juliantaylor/test-file-leakJulian Taylor2014-02-091-7/+8
|\ \ \ | | | | | | | | TST: clean up tempfile in test_closing_zipfile_after_load
| * | | TST: clean up tempfile in test_closing_zipfile_after_loadJulian Taylor2014-02-081-7/+8
| |/ /
* | | TST: fix test_io.TestSavezLoadJulian Taylor2014-02-081-1/+1
|/ /
* | ENH: remove insecure mktemp useJulian Taylor2014-02-061-8/+16
| | | | | | | | | | mktemp only returns a filename, a malicous user could replace it before it gets used.
* | BUG: IRR was returning nan instead of valid negative answer.Philip Eliot2014-02-011-0/+15
|/ | | | | | | | | | | | | | | | This change corrects the following two bugs in numpy.irr: * When the solution was negative, numpy.irr returned nan instead of the correct solution because of the mask applied to the roots. Corrected by removing the mask that 0 < res < 1. * When multiple roots were found, numpy.irr was returning an array of all roots rather than a single float. This bug was corrected by selecting the single root closest to zero (min(abs(root)). With these corrections, numpy.irr returns the same result as the corresponding spreadsheet function in LibreOffice Calc for all test cases (additional test cases were added to cover cases with multiple positive and negative roots)
* TST: document reason for truncate instead of seek past endJulian Taylor2014-01-141-0/+3
|
* BUG: fix large file support on 32 bit systemsJulian Taylor2014-01-111-0/+24
| | | | | | On linux large file support must be enabled and ftello used to avoid overflows. The result must not be converted to a size_t, but a long long.
* TST: fix test failure due to comparing floats with assert_equal.Ralf Gommers2013-12-231-1/+1
| | | | Observed on 32-bit linux with python 3.4b1
* Merge pull request #4112 from rhewett/meshgrid_singleseberg2013-12-221-17/+22
|\ | | | | ENH: Allow meshgrid to take 1D and 0D inputs
| * ENH: Allow meshgrid to work for 1D and 0D cases.rhewett2013-12-181-17/+22
| |
* | Merge pull request #4102 from seberg/issue-612Charles Harris2013-12-201-2/+8
|\ \ | | | | | | FIX: Array split should not hack empty array shape away
| * | BUG: Fix array_split empty array type and add FutureWarningSebastian Berg2013-12-201-2/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the result type of empty output arrays. The FutureWarning warns about changed behaviour. A "kludge" was introduced into array split converting converting the result of something like: >>> np.array_split(np.array([[1, 1]]), 2) [array([[1, 1]]), array([], dtype=int64)] instead of retaining the shape of the empty/second array to be (0, 2). A FutureWarning is now raised when such a replacement occurs. Closes gh-612
* | MAINT: Change test to read random sized chunksMax Sperlich2013-12-111-13/+9
| | | | | | | | | | Speeds the test up vs. reading single bytes at a time, and is now correctly handled when reading the magic string and array header.
* | MAINT: Introduced _read_array functionMax Sperlich2013-12-111-0/+8
| | | | | | | | | | | | | | | | | | This wrapper function is used everywhere in format.py now to ensure to correctly the handle the case when fp.read returns fewer bytes than requested. Also added a test for the orignal bug, loading an array of size more than 64K from a zip file.
* | MAINT: Better handling of very small chunksMax Sperlich2013-12-091-11/+16
| | | | | | | | | | | | Issue 4093: Improved the handling of the case when the amount of data read by fp.read is smaller than dtype.itemsize. Also changed the test code to make sure this case is tested.