Closed ghylander closed 1 year ago
As the exception suggests, simply changing image.py
line 2233 from:
indexes = np.ones(self.data.shape, dtype=np.bool)
to:
indexes = np.ones(self.data.shape, dtype=np.bool_)
Supresses the warning and the exception
I found additional incompatibilities. In the 'mandelbrot' test, the following warning is raised:
guiqwt\tests\mandelbrot.py:60: DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of -1 to uint8 will fail in the future.
For the old behavior, usually:
np.array(value).astype(dtype)`
will give the desired result (the cast overflows).
Then, in the 'pcolor' test, the following exception is reaised. Could be related to the warning raised in the 'mandelbrot' tetst:
Traceback (most recent call last):
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 306, in selection_changed
curve.set_hist_source(item)
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 140, in set_hist_source
self.update_histogram()
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 183, in update_histogram
hist, bin_edges = self.compute_histogram()
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 178, in compute_histogram
return self.get_hist_source().get_histogram(self.bins)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\image.py", line 746, in get_histogram
res = np.histogram(self.data, nbins)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<__array_function__ internals>", line 200, in histogram
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\numpy\lib\histograms.py", line 780, in histogram
bin_edges, uniform_bins = _get_bin_edges(a, bins, range, weights)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\numpy\lib\histograms.py", line 426, in _get_bin_edges
first_edge, last_edge = _get_outer_edges(a, range)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\numpy\lib\histograms.py", line 323, in _get_outer_edges
raise ValueError(
ValueError: autodetected range of [nan, nan] is not finite
Hi, Thanks for the feedback.
Didn't find any issue related to this
Starting in numpy 1.20 (release notes), "using the aliases of builtin types like np.int is deprecated". This results in the following warning:
guiqwt\image.py:2233: FutureWarning: In the future 'np.bool' will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions.
However, in numpy 1.24, the following exception is raised:
AttributeError: module 'numpy' has no attribute 'bool'. Did you mean: 'bool_'?
This behaviour can be observed in the guiqwt test "image_masked.py", when applying a "mask (outside)", then selecting "apply".
This is fixed by: https://github.com/PierreRaybaut/guiqwt/commit/56ae061e128bcf95e489c347a475ea83dc22fb5a
I found additional incompatibilities. In the 'mandelbrot' test, the following warning is raised:
guiqwt\tests\mandelbrot.py:60: DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of -1 to uint8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).
This one is probably due to the fact that the mandelbrot extension (Cython) somehow returns negative values that where until now casted without warning by NumPy. I will treat this separetely: #106
Then, in the 'pcolor' test, the following exception is reaised. Could be related to the warning raised in the 'mandelbrot' tetst:
Traceback (most recent call last): File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 306, in selection_changed curve.set_hist_source(item) File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 140, in set_hist_source self.update_histogram() File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 183, in update_histogram hist, bin_edges = self.compute_histogram() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\histogram.py", line 178, in compute_histogram return self.get_hist_source().get_histogram(self.bins) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\guiqwt\image.py", line 746, in get_histogram res = np.histogram(self.data, nbins) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<__array_function__ internals>", line 200, in histogram File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\numpy\lib\histograms.py", line 780, in histogram bin_edges, uniform_bins = _get_bin_edges(a, bins, range, weights) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\numpy\lib\histograms.py", line 426, in _get_bin_edges first_edge, last_edge = _get_outer_edges(a, range) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\miniconda3\envs\env_name\Lib\site-packages\numpy\lib\histograms.py", line 323, in _get_outer_edges raise ValueError( ValueError: autodetected range of [nan, nan] is not finite
This should be fixed by https://github.com/PierreRaybaut/guiqwt/commit/6d815e19659561b70c258dd5937442f371f02983
Didn't find any issue related to this
Starting in numpy 1.20 (release notes), "using the aliases of builtin types like np.int is deprecated". This results in the following warning:
guiqwt\image.py:2233: FutureWarning: In the future 'np.bool' will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions.
However, in numpy 1.24, the following exception is raised:
AttributeError: module 'numpy' has no attribute 'bool'. Did you mean: 'bool_'?
This behaviour can be observed in the guiqwt test "image_masked.py", when applying a "mask (outside)", then selecting "apply".