From f0e233031e51a69bd3c23c616ff861d2b2931bd1 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 13 Jul 2016 15:26:15 +0800 Subject: spline.py: improve the np.array usage a bit --- spline.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'spline.py') diff --git a/spline.py b/spline.py index 3470a1a..20ec1cf 100644 --- a/spline.py +++ b/spline.py @@ -2,7 +2,11 @@ # # Aaron LI # Created: 2016-07-10 -# Updated: 2016-07-10 +# Updated: 2016-07-13 +# +# Change logs: +# 2016-07-13: +# * Improve the `np.array` usage a bit # """ @@ -83,9 +87,7 @@ class SmoothSpline(Spline): weights=weights, method="REML") def eval(self, x): - x = np.array(x) - if x.shape == (): - x = x.reshape((1,)) + x = np.array(x, ndmin=1) if "X" in self.log10: x_new = ro.ListVector({"x": ro.FloatVector(np.log10(x))}) else: -- cgit v1.2.2