| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* BUG: properly handle tuple keys in NpZFile.__getitem__
* TST: test tuple rendering specifically.
---------
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
|
|
|
|
|
|
|
|
|
| |
This PR adds additional tests for quantiles:
1. Identification equation $E[V(q, Y)] = 0$
2. Adding a constant $c > 0$: $q(c + Y) = c + q(Y)$
3. Multiplying by a constant $c > 0$: $q(c \cdot Y) = c \cdot q(y)$
4. Multiplying by $-1$: $q_{\alpha}(-Y) = -q_{1-\alpha}(Y)$
(Note by seberg as reviewer: These tests are fairly complex, but may be useful for future development. But if they seem too complicated, they are probably not really vital and could be shortened or removed.)
|
|
|
|
|
|
|
|
|
|
|
| |
Improves the repr to include information about the arrays contained, e.g.:
>>> npzfile = np.load('arr.npz')
>>> npzfile
NpzFile 'arr.npz' with keys arr_0, arr_1, arr_2, arr_3, arr_4...
closes #23319
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
ENH: Enabled the use of numpy.vectorize as a decorator
|
| |
| |
| |
| | |
This reverses commit 7a2ded1522305
|
| | |
|
| |
| |
| |
| |
| | |
This test makes sure a function's docstring is properly preserved
after calling the vectorize decorator.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Most of this code comes from PR-9593, but with the default value for pyfunc
being numpy._NoValue instead of None, no override of __new__, and no effort
to make subclassing possible.
Co-Authored-By: Michael Lamparski <diagonaldevice@gmail.com>
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
As discussed in
https://mail.python.org/archives/list/numpy-discussion@python.org/thread/UKZJACAP5FUG7KP2AQDPE4P5ADNWLOHZ/
This flag was always meant to be temporary, and cleaning it up is
long overdue.
|
| | |
|
| |
| |
| |
| | |
[skip cirrus]
|
|\ \
| | |
| | | |
API: Add environment variable for behavior planned in a 2.0
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This change is staged for NumPy 2.0, I assume we could get away with
it otherwise, but it is a nice example and probably not pressing.
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, the following code:
```
import numpy as np
with open('foo.npy', 'wb') as f:
for i in range(np.random.randint(10)):
np.save(f, 1)
with open('foo.npy', 'rb') as f:
while True:
np.load(f)
```
Will raise:
```
ValueError: Cannot load file containing pickled data when allow_pickle=False
```
While there is no pickled data in the file.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The `__array_function__` API currently will exhaust iterators so we
cannot accept sequences reasonably. Checking for `__getitem__` is presumably
enough to reject that (and was what the deprecation used).
Future changes could allow this again, although it is not a useful API
anyway, since we have to materialize the iterable in any case.
|
| |
| |
| |
| |
| |
| |
| | |
This pull requests speeds up numpy.load. Since _filter_header is quite a bottleneck, we only run it if we must. Users will get a warning if they have a legacy Numpy file so that they can save it again for faster loading.
Main discussion and benchmarks see #22898
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
|
| |
| |
| |
| | |
The number "changed" is weird if the user fixed it, so give a different
message in that case.
|
|/
|
|
|
|
|
| |
whitespace (#22906)
Fix issue with `delimiter=None` and quote character not working properly (not using whitespace delimiter mode).
Closes gh-22899
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* TST: Mixed integer types for in1d
* BUG: Fix mixed dtype overflows for in1d (#22877)
* BUG: Type conversion for integer overflow check
* MAINT: Fix linting issues in in1d
* MAINT: ar1 overflow check only for non-empty array
* MAINT: Expand bounds of overflow check
* TST: Fix integer overflow in mixed boolean test
* TST: Include test for overflow on mixed dtypes
* MAINT: Less conservative overflow checks
|
|
|
|
|
|
|
|
| |
The tests randomize the nan pattern and thus can run into these
(additional) warnings, so ignore them.
(Could also fix the random seed, but this should do)
Closes gh-22835
|
|
|
|
|
|
|
| |
If a row ends in a delimiter, `add_fields` can be called twice without
any field actually being parsed. This causes issues with the field
buffer setup.
closes gh-22833
|
|
|
|
| |
There should be more tests for this, but this now passes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since percentile is more or less identical to quantile, I also made it
throw an error if it receives a complex input. I also made nanquantile
and nanpercentile throw errors as well.
* Made the changes recommended by seberg
* Fixed a test for PR 22703
* Fixed tests for quantile
* Shortened some more lines
* Fixup more lines
Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
|
|
|
|
|
|
|
|
|
| |
np.pad with mode="wrap" returns unexpected result that original data is not strictly looped in padding. This may happen in some occassions when padding widths in the same dimension are unbalanced (see added testcase in test_arraypad.py and the related issue). The reason is the function pad makes iterative calls of _set_wrap_both() in the above situation, yet period for padding is not correctly computed in each iteration.
The bug is fixed by guaranteeing that period is always a multiple of original data size, and also be the possible maximum for computation efficiency.
Closes #22464
Co-authored-by: Lars Grüter <lagru+github@mailbox.org>
|
|
|
|
|
|
| |
`numpy.percentile()`, and `numpy.quantile()`.
Closes #22714, #22544.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* BUG: Histogramdd breaks on big arrays in Windows
Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py
* BUG: Histogramdd breaks on big arrays in Windows
Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py
* Removed the binary files
* Update test_histograms.py
* Update test_histograms.py
* Update test_histograms.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* BUILD: update OpenBLAS to 0.3.21 and clean up openblas download test
* set LDFLAGS on windows64 like the openblaslib build does
* use rtools compilers on windows when building wheels
* fix typos
* add rtools gfortran to PATH
* use the openblas dll from the zip archive without rewrapping
* typos
* copy dll import library for 64-bit interfaces
* revert many of the changes to azure-steps-windows.yaml, copy openblas better in wheels
* fix wildcard copy
* test OpenBLAS build worked with threadpoolctl
* typos
* install threadpoolctl where needed, use for loop to recursively copy
* update macos OpenBLAS suffixes for newer gfortran hashes
* use libgfortran5.dylib on macos
* fix scripts
* re-use gfortran install from MacPython/gfortran-install on macos
* use pre-release version of delocate
* fixes for wheel builds/tests
* add debugging cruft for pypy+win, macos wheels
* add DYLD_LIBRARY_PATH on macosx-x86_64
* use 32-bit openblas interfaces for ppc64le tests
* skip large_archive test that sometimes segfaults on PyPy+windows
|
| |
|
|
|
|
| |
Not new things, but in touched lines...
|
|
|
|
|
|
|
|
| |
In some cases, the replacement is clearly not what is intended,
in those (where setup was called explicitly), I mostly renamed
`setup` to `_setup`.
The `test_ccompile_opt` is a bit confusing, so left it right now
(this will probably fail)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
>>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=[('x', float), ('y', float)]) # failed
>>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=np.dtype([('x', float), ('y', float)])) # success
After:
>>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=[('x', float), ('y', float)]) # success
>>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=np.dtype([('x', float), ('y', float)])) # success
Closes gh-22428
|
| |
|
|\
| |
| | |
MAINT: Ensure graceful handling of large header sizes
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This ensures graceful handling of large header files. Unfortunately,
it may be a bit inconvenient for users, thus the new kwarg and the
work-around of also accepting allow-pickle.
See also the documation here:
https://docs.python.org/3.10/library/ast.html#ast.literal_eval
|
|/ |
|
|\
| |
| | |
TST: add functional tests for kron
|
| | |
|
|/
|
|
|
|
| |
Currently the location of the function definition is always reported
to be `numpy.lib.utils`; this changes it to be the location of the
actual definition when possible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since Python 3.8, the default start method for multiprocessing has been changed from fork to spawn on macOS
The default start method is still fork on other Unix platforms[1], causing inconsistency on memory sharing model
It will cause a memory-sharing problem for the test test_large_zip on macOS as the memory sharing model between spawn and fork is different
The fix
Change the start method for this test back to fork under this testcase context
In this test case context, the bug that caused default start method changed to spawn for macOS will not be triggered
It is context limited, so this change will not affect default start method other than test_large_zip
All platforms have the same memory sharing model now
After the change, test_large_zip is passed on macOS
https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
Closes gh-22203
|
| |
|
|
|
|
|
|
|
|
|
| |
The lerp test compared the output of the original and the symmetric
functions by using basic assertion. Double precision errors could
accumulate in a way that the 2 outputs mismatch by epsilon.
For more information on the precision issue, see #22073
Fix: use assert_allclose instead for float comparison.
|