Repository navigation
Closed
Description
Description
it should at least use skimage units.
needs a deprecation cycle
>>> from skimage.transform import radon
>>> import numpy as np
>>> a = np.ones((2, 2), dtype='uint8')
>>> from numpy.testing import assert_allclose
>>> assert_allclose(radon(a), radon(a.astype('float64')))
>>> from skimage import img_as_float
>>> assert_allclose(radon(a), radon(img_as_float(a)))
/home/mark/miniconda3/envs/owl/lib/python3.7/site-packages/skimage/transform/radon_transform.py:58: UserWarning: The default of `circle` in `skimage.transform.radon` will change to `True` in version 0.15.
warn('The default of `circle` in `skimage.transform.radon` '
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-9-f353f5050d50> in <module>
----> 1 assert_allclose(radon(a), radon(img_as_float(a)))
~/miniconda3/envs/owl/lib/python3.7/site-packages/numpy/testing/_private/utils.py in assert_allclose(actual, desired, rtol, atol, equal_nan, err_msg, verbose)
1457 header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol)
1458 assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
-> 1459 verbose=verbose, header=header, equal_nan=equal_nan)
1460
1461
~/miniconda3/envs/owl/lib/python3.7/site-packages/numpy/testing/_private/utils.py in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf)
794 verbose=verbose, header=header,
795 names=('x', 'y'), precision=precision)
--> 796 raise AssertionError(msg)
797 except ValueError:
798 import traceback
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0
(mismatch 99.62962962962963%)
x: array([[2.000000e+00, 1.965247e+00, 1.930810e+00, 1.896699e+00,
1.862923e+00, 1.829494e+00, 1.796421e+00, 1.763715e+00,
1.731386e+00, 1.699443e+00, 1.667896e+00, 1.636755e+00,...
y: array([[7.843137e-03, 7.706853e-03, 7.571805e-03, 7.438034e-03,
7.305580e-03, 7.174486e-03, 7.044789e-03, 6.916530e-03,
6.789748e-03, 6.664481e-03, 6.540768e-03, 6.418646e-03,...Version information
$ python
Python 3.7.1 | packaged by conda-forge | (default, Feb 26 2019, 04:48:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import print_function
>>> import sys; print(sys.version)
3.7.1 | packaged by conda-forge | (default, Feb 26 2019, 04:48:14)
[GCC 7.3.0]
>>> import platform; print(platform.platform())
Linux-4.15.0-45-generic-x86_64-with-debian-buster-sid
>>> import skimage; print("scikit-image version: {}".format(skimage.__version__))
scikit-image version: 0.14.2
>>> import numpy; print("numpy version: {}".format(numpy.__version__))
numpy version: 1.16.0Metadata
Metadata
Assignees
Labels
No labels
Activity
rfezzani commentedon Aug 30, 2019
In fact, as stipulated in #4130, this is because there is no management of data type in
radonfunction (no call toconvert_to_float).In the example that you provide,
ais implicitly converted todoubleinradoncall, making it all ones and thus different fromimg_as_float(a).Adding a call to
convert_to_floatwith the correct setting ofpreserve_rangegives a predictable behavior:rfezzani commentedon Sep 25, 2019
I think that you can close this issue as it is fixed by #4131 ;-)