Merged
Conversation
1) use lowercase names of nan, inf 2) avoid accessing np.core which is considered private 3) ensure clip limits fit within data dtype 4) rename row_stack to vstack
Contributor
Author
|
Just a short script to verify that pyqtgraph's import time
import numpy as np
print(np.__version__)
rng = np.random.default_rng(0)
shape = 10000
data = rng.random(size=shape, dtype=np.float32)
niters = 10000
for alpha in [0.1, 0.25]:
for name, func in [('np', np.clip), ('pg', np.core.umath.clip)]:
vmin, vmax = alpha, 1 - alpha
output = np.zeros_like(data)
t0 = time.perf_counter()
for _ in range(niters):
res = func(data, vmin, vmax, out=output)
t1 = time.perf_counter()
print(name, data.dtype, alpha, t1 - t0) |
0949949 to
6671a39
Compare
Member
|
I'm surprised more changes weren't needed for NumPy 2.0, guess goes to show you how mature their API is. Thanks for the PR @pijyoi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the test suite to pass with NumPy 2.0, which may be releasing soon (numpy/numpy#24300).