Skip to content

Commit 9cffade

Browse files
authored
Merge pull request pyqtgraph#3025 from pijyoi/remove-numba-rescaledata
remove numba for rescaleData
2 parents c606238 + ead71bf commit 9cffade

File tree

3 files changed

+1
-35
lines changed

3 files changed

+1
-35
lines changed

pyqtgraph/functions.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from .metaarray import MetaArray
1919
from .Qt import QT_LIB, QtCore, QtGui
2020
from .util.cupy_helper import getCupy
21-
from .util.numba_helper import getNumbaFunctions
2221

2322
# in order of appearance in this file.
2423
# add new functions to this list only if they are to reside in pg namespace.
@@ -1268,11 +1267,6 @@ def rescaleData(data, scale, offset, dtype=None, clip=None):
12681267
# don't copy if no change in dtype
12691268
return data_out.astype(out_dtype, copy=False)
12701269

1271-
numba_fn = getNumbaFunctions()
1272-
if numba_fn and clip is not None:
1273-
# if we got here by makeARGB(), clip will not be None at this point
1274-
return numba_fn.rescaleData(data, scale, offset, out_dtype, clip)
1275-
12761270
return _rescaleData_nditer(data, scale, offset, work_dtype, out_dtype, clip)
12771271

12781272

pyqtgraph/functions_numba.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
import numba
22
import numpy as np
33

4-
rescale_functions = {}
5-
6-
def rescale_clip_source(xx, scale, offset, vmin, vmax, yy):
7-
for i in range(xx.size):
8-
val = (xx[i] - offset) * scale
9-
yy[i] = min(max(val, vmin), vmax)
10-
11-
def rescaleData(data, scale, offset, dtype, clip):
12-
data_out = np.empty_like(data, dtype=dtype)
13-
key = (data.dtype.name, data_out.dtype.name)
14-
func = rescale_functions.get(key)
15-
if func is None:
16-
func = numba.guvectorize(
17-
[f'{key[0]}[:],f8,f8,f8,f8,{key[1]}[:]'],
18-
'(n),(),(),(),()->(n)',
19-
nopython=True)(rescale_clip_source)
20-
rescale_functions[key] = func
21-
func(data, scale, offset, clip[0], clip[1], out=data_out)
22-
return data_out
23-
244
@numba.jit(nopython=True)
255
def rescale_and_lookup(data, scale, offset, lut):
266
# data should be floating point and 2d

tests/test_makeARGB.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
from .makeARGB_test_data import EXPECTED_OUTPUTS, INPUTS, LEVELS, LUTS
1010

1111

12-
try:
13-
import numba
14-
except ImportError:
15-
pass
16-
1712
try:
1813
import cupy
1914
except ImportError:
@@ -35,7 +30,6 @@ def _makeARGB(*args, **kwds):
3530
@pytest.mark.parametrize('acceleration', [
3631
pytest.param('numpy'),
3732
pytest.param('cupy', marks=pytest.mark.skipif('cupy' not in sys.modules, reason="CuPy not available")),
38-
pytest.param('numba', marks=pytest.mark.skipif('numba' not in sys.modules, reason="numba not available"))
3933
]
4034
)
4135
@pytest.mark.parametrize('dtype', [np.uint8, np.uint16, np.float32])
@@ -45,9 +39,7 @@ def _makeARGB(*args, **kwds):
4539
@pytest.mark.parametrize('scale', [None, 232, 13333])
4640
@pytest.mark.parametrize('use_rgba', [True, False])
4741
def test_makeARGB_against_generated_references(acceleration, dtype, in_fmt, level_name, lut_type, scale, use_rgba):
48-
if acceleration == "numba":
49-
setConfigOptions(useCupy=False, useNumba=True)
50-
elif acceleration == "cupy":
42+
if acceleration == "cupy":
5143
setConfigOptions(useCupy=True, useNumba=False)
5244
else:
5345
setConfigOptions(useCupy=False, useNumba=False)

0 commit comments

Comments
 (0)