From 1fb9bfe3df7814828a625f83ef5a91b2dac7e127 Mon Sep 17 00:00:00 2001 From: Simon Guillot Date: Tue, 8 Jul 2014 14:45:27 +0200 Subject: [PATCH 1/2] Fix deprecation warning in `simple_linear_interpolation` --- lib/matplotlib/cbook.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 84540887b95a..786680468450 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -1737,8 +1737,8 @@ def simple_linear_interpolation(a, steps): if steps == 1: return a - steps = np.floor(steps) - new_length = ((len(a) - 1) * steps) + 1 + step = int(np.floor(steps)) + new_length = (len(a) - 1) * steps + 1 new_shape = list(a.shape) new_shape[0] = new_length result = np.zeros(new_shape, a.dtype) @@ -1746,8 +1746,7 @@ def simple_linear_interpolation(a, steps): result[0] = a[0] a0 = a[0:-1] a1 = a[1:] - delta = ((a1 - a0) / steps) - steps = int(steps) + delta = (a1 - a0) / float(steps) for i in range(1, steps): result[i::steps] = delta * i + a0 result[steps::steps] = a1 From 48257d16795e374eb01107a095dc42f36d37b3ae Mon Sep 17 00:00:00 2001 From: Simon Guillot Date: Wed, 9 Jul 2014 13:30:04 +0200 Subject: [PATCH 2/2] remove float cast in `simple_linear_interpolation` --- lib/matplotlib/cbook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 786680468450..bf73361b967f 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -1746,7 +1746,7 @@ def simple_linear_interpolation(a, steps): result[0] = a[0] a0 = a[0:-1] a1 = a[1:] - delta = (a1 - a0) / float(steps) + delta = (a1 - a0) / steps for i in range(1, steps): result[i::steps] = delta * i + a0 result[steps::steps] = a1