Re: Doctest failures
Several of these might be solved by globally forcing the expected numpy.set_printoptions <http://docs.scipy.org/doc/numpy/reference/generated/numpy.set_printoptions.h...> prior to running the doctests. I'm not sure why this would differ in certain platforms, but for whatever reason it looks like on OSX 10.9 you're reliably printing an additional two digits. The second to last error, in skimage.measure._label.label, looks like a real error / malformed example to me. Josh On Friday, June 20, 2014 9:18:34 AM UTC-5, Juan Nunez-Iglesias wrote:
Hi all,
I'm running this <https://github.com/scikit-image/skimage-tutorials/blob/master/scipy-2014/che...> on my system (OSX 10.9) and getting some doctest failures, apparently due to precision issues (see below). Can people please run this on theirs and see what happens, and offer ideas re: fixing it? I imagine something like setting the precision of numpy printouts will do, but it would be best if that can be a global setting.
In the meantime, I might not run the doctests in this script, so that people don't incorrectly fail their check_env for the SciPy 2014 tutorial... Thoughts?
Thanks!
Juan.
........................................F.F...................................F./Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py:4: skimage_deprecation: Call to deprecated function ``label``. Use ``skimage.measure.label`` instead. return _label(input, neighbors, background, return_num) ..F....................................................... ====================================================================== FAIL: Doctest: skimage.feature.texture.greycoprops ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 2226, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for skimage.feature.texture.greycoprops File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/feature/texture.py", line 125, in greycoprops
---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/feature/texture.py", line 176, in skimage.feature.texture.greycoprops Failed example: contrast Expected: array([[ 0.58333333, 1. ], [ 1.25 , 2.75 ]]) Got: array([[ 0.5833333333, 1. ], [ 1.25 , 2.75 ]])
====================================================================== FAIL: Doctest: skimage.filter._gaussian.gaussian_filter ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 2226, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for skimage.filter._gaussian.gaussian_filter File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/filter/_gaussian.py", line 13, in gaussian_filter
---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/filter/_gaussian.py", line 73, in skimage.filter._gaussian.gaussian_filter Failed example: gaussian_filter(a, sigma=0.4) # mild smoothing Expected: array([[ 0.00163116, 0.03712502, 0.00163116], [ 0.03712502, 0.84496158, 0.03712502], [ 0.00163116, 0.03712502, 0.00163116]]) Got: array([[ 0.0016311596, 0.0371250207, 0.0016311596], [ 0.0371250207, 0.8449615765, 0.0371250207], [ 0.0016311596, 0.0371250207, 0.0016311596]]) ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/filter/_gaussian.py", line 77, in skimage.filter._gaussian.gaussian_filter Failed example: gaussian_filter(a, sigma=1) # more smooting Expected: array([[ 0.05855018, 0.09653293, 0.05855018], [ 0.09653293, 0.15915589, 0.09653293], [ 0.05855018, 0.09653293, 0.05855018]]) Got: array([[ 0.0585501805, 0.096532928 , 0.0585501805], [ 0.096532928 , 0.1591558917, 0.096532928 ], [ 0.0585501805, 0.096532928 , 0.0585501805]]) ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/filter/_gaussian.py", line 82, in skimage.filter._gaussian.gaussian_filter Failed example: gaussian_filter(a, sigma=1, mode='reflect') Expected: array([[ 0.08767308, 0.12075024, 0.08767308], [ 0.12075024, 0.16630671, 0.12075024], [ 0.08767308, 0.12075024, 0.08767308]]) Got: array([[ 0.0876730803, 0.1207502431, 0.0876730803], [ 0.1207502431, 0.1663067063, 0.1207502431], [ 0.0876730803, 0.1207502431, 0.0876730803]])
====================================================================== FAIL: Doctest: skimage.measure._label.label ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 2226, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for skimage.measure._label.label File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line unknown line number, in label
---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line ?, in skimage.measure._label.label Failed example: x = np.eye(3).astype(int) Exception raised: Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest skimage.measure._label.label[0]>", line 1, in <module> x = np.eye(3).astype(int) NameError: name 'np' is not defined ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line ?, in skimage.measure._label.label Failed example: print(x) Exception raised: Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest skimage.measure._label.label[1]>", line 1, in <module> print(x) NameError: name 'x' is not defined ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line ?, in skimage.measure._label.label Failed example: print(m.label(x, neighbors=4)) Exception raised: Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest skimage.measure._label.label[2]>", line 1, in <module> print(m.label(x, neighbors=4)) NameError: name 'm' is not defined ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line ?, in skimage.measure._label.label Failed example: print(m.label(x, neighbors=8)) Exception raised: Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest skimage.measure._label.label[3]>", line 1, in <module> print(m.label(x, neighbors=8)) NameError: name 'm' is not defined ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line ?, in skimage.measure._label.label Failed example: x = np.array([[1, 0, 0], [1, 1, 5], [0, 0, 0]]) Exception raised: Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest skimage.measure._label.label[4]>", line 1, in <module> x = np.array([[1, 0, 0], NameError: name 'np' is not defined ---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/_label.py", line ?, in skimage.measure._label.label Failed example: print(m.label(x, background=0)) Exception raised: Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest skimage.measure._label.label[5]>", line 1, in <module> print(m.label(x, background=0)) NameError: name 'm' is not defined
====================================================================== FAIL: Doctest: skimage.measure.fit.ransac ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/nuneziglesiasj/anaconda/lib/python2.7/doctest.py", line 2226, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for skimage.measure.fit.ransac File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/fit.py", line 470, in ransac
---------------------------------------------------------------------- File "/Users/nuneziglesiasj/anaconda/lib/python2.7/site-packages/skimage/measure/fit.py", line 576, in skimage.measure.fit.ransac Failed example: ransac_model.params Expected: array([ 20.12762373, 29.73563063, 4.81499637, 10.4743584 , 0.05217117]) Got: array([ 20.1276237259, 29.7356306313, 4.8149963715, 10.474358404 , 0.0521711691])
On Sat, Jun 21, 2014 at 1:27 AM, Josh Warner <silvertrumpet999@gmail.com> wrote:
The second to last error, in skimage.measure._label.label, looks like a real error / malformed example to me.
Juan, did you have another look at this? If this is a bug, we should file it so we don't forget. Stéfan
participants (2)
-
Josh Warner
-
Stéfan van der Walt