def _smooth(self, efold, y):
        try:
            y.size > self.lookback
        except __HOLE__:
            'Y must have at least self.lookback elements.'

        ysmooth = np.zeros(y.size)
        ysmooth[0] = y[0]

        peffective = 0.0  # trace of the smoothing matrix, the effective number of parameters

        # treat the first self.lookback data points seperately, since the base-line is shorter
        for i in xrange(1, self.lookback):
            weights = self.weights(efold, lookback=i)
            ysmooth[i] = weights.dot(y[0:i])
            peffective += weights[-1]

        weights = self.weights(efold)
        for i in xrange(y.size - self.lookback - 1):
            idx = self.lookback + i
            # estimate current y as exponentially-weighted average of previous self.lookback y-values
            ysmooth[idx] = weights.dot(y[idx - self.lookback:idx])
            peffective += weights[-1]

        ysmooth[-1] = weights.dot(y[y.size - self.lookback - 1:-1])
        peffective += weights[-1]

        return ysmooth, peffective
dataset/ETHPy150Open brandonckelly/bck_stats/bck_stats/gcv_smoother.py/GcvExpSmoother._smooth