diff --git a/wafo/interpolate.py b/wafo/interpolate.py index 70819e1..4e52682 100644 --- a/wafo/interpolate.py +++ b/wafo/interpolate.py @@ -546,7 +546,7 @@ class SmoothSpline(PPform): self.linear_extrapolate(output=False) def _compute_coefs(self, xx, yy, p=None, var=1): - x, y = np.atleast_1d(xx, yy) + x, y, var = np.atleast_1d(xx, yy, var) x = x.ravel() dx = np.diff(x) must_sort = (dx < 0).any() @@ -573,7 +573,7 @@ class SmoothSpline(PPform): dydx = np.diff(y) / dx - if (n == 2): # % straight line + if (n == 2): # straight line coefs = np.vstack([dydx.ravel(), y[0, :]]) else: diff --git a/wafo/transform/estimation.py b/wafo/transform/estimation.py index be80b9f..b365e71 100644 --- a/wafo/transform/estimation.py +++ b/wafo/transform/estimation.py @@ -7,7 +7,7 @@ from __future__ import absolute_import from .core import TrData from .models import TrHermite, TrOchi, TrLinear from ..stats import edf, skew, kurtosis -from ..interpolate import SmoothSpline +from ..interpolate import SmoothSpline, interp1d from scipy.special import ndtri as invnorm from scipy.integrate import cumtrapz import warnings @@ -109,6 +109,7 @@ class TransformEstimator(object): if (dy <= 0).any(): dy[dy > 0] = eps gvar = -(np.hstack((dy, 0)) + np.hstack((0, dy))) / 2 + eps + gvar = interp1d(tr.args, gvar)(tr_raw.args) pp_tr = SmoothSpline(tr_raw.args, tr_raw.data, p=1, lin_extrap=self.linextrap, var=ix * gvar)