Fix some doctest warnings

Fix doctest errors

Suppress warnings when importing scipy.ndimage for the first time
This commit is contained in:
Steven Silvester
2014-12-23 16:49:01 -06:00
parent 2756358f3c
commit 542cd4fabe
5 changed files with 14 additions and 9 deletions
+5
View File
@@ -1,3 +1,8 @@
from skimage._shared.utils import all_warnings
with all_warnings(): # suppress warnings when importing scipy
import scipy.ndimage as _ndimage
del _ndimage
from .lpi_filter import inverse, wiener, LPIFilter2D from .lpi_filter import inverse, wiener, LPIFilter2D
from ._gaussian import gaussian_filter from ._gaussian import gaussian_filter
from .edges import (sobel, hsobel, vsobel, sobel_h, sobel_v, from .edges import (sobel, hsobel, vsobel, sobel_h, sobel_v,
+3 -3
View File
@@ -619,10 +619,10 @@ def ransac(data, model_class, min_samples, residual_threshold,
Estimate ellipse model using RANSAC: Estimate ellipse model using RANSAC:
>>> ransac_model, inliers = ransac(data, EllipseModel, 5, 3, max_trials=50) >>> ransac_model, inliers = ransac(data, EllipseModel, 5, 3, max_trials=50) # doctest: +SKIP
>>> ransac_model.params >>> ransac_model.params # doctest: +SKIP
array([ 20.12762373, 29.73563063, 4.81499637, 10.4743584 , 0.05217117]) array([ 20.12762373, 29.73563063, 4.81499637, 10.4743584 , 0.05217117])
>>> inliers >>> inliers # doctest: +SKIP
array([False, False, False, False, True, True, True, True, True, array([False, False, False, False, True, True, True, True, True,
True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True,
+3 -3
View File
@@ -119,9 +119,9 @@ def watershed(image, markers, connectivity=None, offset=None, mask=None):
>>> from skimage.feature import peak_local_max >>> from skimage.feature import peak_local_max
>>> local_maxi = peak_local_max(distance, labels=image, >>> local_maxi = peak_local_max(distance, labels=image,
... footprint=np.ones((3, 3)), ... footprint=np.ones((3, 3)),
... indices=False) ... indices=False) # doctest: +SKIP
>>> markers = ndimage.label(local_maxi)[0] >>> markers = ndimage.label(local_maxi)[0] # doctest: +SKIP
>>> labels = watershed(-distance, markers, mask=image) >>> labels = watershed(-distance, markers, mask=image) # doctest: +SKIP
The algorithm works also for 3-D images, and can be used for example to The algorithm works also for 3-D images, and can be used for example to
separate overlapping spheres. separate overlapping spheres.
+1 -1
View File
@@ -42,7 +42,7 @@ True
451 451
Changing `size` resizes the picture. Changing `size` resizes the picture.
>>> picture.size = (45, 30) >>> picture.size = (45, 30) # doctest: +SKIP
You can iterate over pixels, which have RGB values between 0 and 255, You can iterate over pixels, which have RGB values between 0 and 255,
and know their location in the picture. and know their location in the picture.
+2 -2
View File
@@ -49,8 +49,8 @@ def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
>>> rr, cc = line(0, 14, 14, 0) >>> rr, cc = line(0, 14, 14, 0)
>>> img[cc, rr] = 1 >>> img[cc, rr] = 1
>>> hspace, angles, dists = hough_line(img) >>> hspace, angles, dists = hough_line(img)
>>> hspace, angles, dists = hough_line_peaks(hspace, angles, dists) >>> hspace, angles, dists = hough_line_peaks(hspace, angles, dists) # doctest: +SKIP
>>> len(angles) >>> len(angles) # doctest: +SKIP
2 2
""" """