From 2e9e6a4ce3f2c208986f26ac2407b8550ec249c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Mon, 9 Dec 2013 00:04:54 +0100 Subject: [PATCH] Fix doctests --- skimage/feature/template.py | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/skimage/feature/template.py b/skimage/feature/template.py index d90fe0c5..4533c636 100644 --- a/skimage/feature/template.py +++ b/skimage/feature/template.py @@ -60,33 +60,33 @@ def match_template(image, template, pad_input=False, mode='constant', >>> template = np.zeros((3, 3)) >>> template[1, 1] = 1 >>> template - array([[ 0. 0. 0.] - [ 0. 1. 0.] - [ 0. 0. 0.]]) + array([[ 0., 0., 0.], + [ 0., 1., 0.], + [ 0., 0., 0.]]) >>> image = np.zeros((6, 6)) >>> image[1, 1] = 1 >>> image[4, 4] = -1 >>> image - array([[ 0. 0. 0. 0. 0. 0.] - [ 0. 1. 0. 0. 0. 0.] - [ 0. 0. 0. 0. 0. 0.] - [ 0. 0. 0. 0. 0. 0.] - [ 0. 0. 0. 0. -1. 0.] - [ 0. 0. 0. 0. 0. 0.]]) + array([[ 0., 0., 0., 0., 0., 0.], + [ 0., 1., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., -1., 0.], + [ 0., 0., 0., 0., 0., 0.]]) >>> result = match_template(image, template) >>> np.round(result, 3) - array([[ 1. -0.125 0. 0. ] - [-0.125 -0.125 0. 0. ] - [ 0. 0. 0.125 0.125] - [ 0. 0. 0.125 -1. ]]) + array([[ 1. , -0.125, 0. , 0. ], + [-0.125, -0.125, 0. , 0. ], + [ 0. , 0. , 0.125, 0.125], + [ 0. , 0. , 0.125, -1. ]]) >>> result = match_template(image, template, pad_input=True) >>> np.round(result, 3) - array([[-0.125 -0.125 -0.125 0. 0. 0. ] - [-0.125 1. -0.125 0. 0. 0. ] - [-0.125 -0.125 -0.125 0. 0. 0. ] - [ 0. 0. 0. 0.125 0.125 0.125] - [ 0. 0. 0. 0.125 -1. 0.125] - [ 0. 0. 0. 0.125 0.125 0.125]]) + array([[-0.125, -0.125, -0.125, 0. , 0. , 0. ], + [-0.125, 1. , -0.125, 0. , 0. , 0. ], + [-0.125, -0.125, -0.125, 0. , 0. , 0. ], + [ 0. , 0. , 0. , 0.125, 0.125, 0.125], + [ 0. , 0. , 0. , 0.125, -1. , 0.125], + [ 0. , 0. , 0. , 0.125, 0.125, 0.125]]) """ if np.any(np.less(image.shape, template.shape)):