diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-07-13 15:26:15 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-07-13 15:26:15 +0800 |
commit | f0e233031e51a69bd3c23c616ff861d2b2931bd1 (patch) | |
tree | 8f97440ec659777a8c3e2f5716e6721be55912ba | |
parent | 9260cbdb7fadb1abab95f064a8e1d1323ebbd477 (diff) | |
download | cexcess-f0e233031e51a69bd3c23c616ff861d2b2931bd1.tar.bz2 |
spline.py: improve the np.array usage a bit
-rw-r--r-- | spline.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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: |