Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory
python-pyqtgraph
2748.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2748.patch of Package python-pyqtgraph
From 1cf3f2c6a8c1c3efd2b8b2bdba168132dafb3f62 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan <nixchuan@gmail.com> Date: Sat, 17 Jun 2023 10:38:56 +0800 Subject: [PATCH] generate random integers directly --- tests/test_functions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_functions.py b/tests/test_functions.py index e0b079202c..426d757348 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -118,10 +118,15 @@ def test_subArray(): def test_rescaleData(): + rng = np.random.default_rng(12345) dtypes = map(np.dtype, ('ubyte', 'uint16', 'byte', 'int16', 'int', 'float')) for dtype1 in dtypes: for dtype2 in dtypes: - data = (np.random.random(size=10) * 2**32 - 2**31).astype(dtype1) + if dtype1.kind in 'iu': + lim = np.iinfo(dtype1) + data = rng.integers(lim.min, lim.max, size=10, dtype=dtype1, endpoint=True) + else: + data = (rng.random(size=10) * 2**32 - 2**31).astype(dtype1) for scale, offset in [(10, 0), (10., 0.), (1, -50), (0.2, 0.5), (0.001, 0)]: if dtype2.kind in 'iu': lim = np.iinfo(dtype2)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor