Exemplo n.º 1
0
    def from_knots_coeffs(knots, coeffs, k=3):
        n = len(knots) + 2*k

        t = np.empty(n, dtype="d")
        t[:k] = knots[0]
        t[k:-k] = knots
        t[-k:] = knots[-1]

        c = np.zeros(n, dtype="d")
        c[:len(coeffs)] = coeffs

        return LSQUnivariateSpline._from_tck((t, c, k))
Exemplo n.º 2
0
    def from_knots_coeffs(knots, coeffs, k=3):
        n = len(knots) + 2*k

        t = np.empty(n, dtype="d")
        t[:k] = knots[0]
        t[k:-k] = knots
        t[-k:] = knots[-1]

        c = np.zeros(n, dtype="d")
        c[:len(coeffs)] = coeffs

        return LSQUnivariateSpline._from_tck((t, c, k))