예제 #1
0
파일: bspline2.py 프로젝트: pygsl/pygsl
def run():
    N = 1024
    x = numx.arange(N) * (numx.pi * 2 / N)
    y = numx.sin(x)

    b = bspline(10, nbreak)
    b.knots_uniform(x[0], x[-1])
    X = numx.zeros((N, ncoeffs))
    X = b.eval_vector(x)
    c, cov, chisq = multifit.linear(X, y)

    res_x = x[::N / 64]
    X = b.eval_vector(res_x)
    res_y, res_y_err = multifit.linear_est_matrix(X, c, cov)

    pylab.plot(x, y, '-')
    pylab.errorbar(res_x, res_y, fmt='g-', xerr=res_y_err)
예제 #2
0
def run():
    N = 1024
    x = numx.arange(N) * (numx.pi * 2 / N)
    y = numx.sin(x)


    b = bspline(10, nbreak)
    b.knots_uniform(x[0], x[-1])
    X = numx.zeros((N, ncoeffs))
    X = b.eval_vector(x)
    c, cov, chisq = multifit.linear(X, y)


    res_x = x[::N/64]
    X = b.eval_vector(res_x)
    res_y, res_y_err = multifit.linear_est_matrix(X, c, cov)

    pylab.plot(x,y, '-')
    pylab.errorbar(res_x, res_y, fmt='g-', xerr=res_y_err)    
예제 #3
0
def run():
    N = 1024
    x = numx.arange(N) * (numx.pi * 2 / N)
    y = numx.sin(x)

    b = bspline(4, nbreak)
    k = b.get_internal_knots()
    pygsl.set_debug_level(10)
    b.knots(k)
    X = b.eval_vector(x)
    c, cov, chisq = multifit.linear(X, y)

    b.set_coefficients_and_covariance_matrix(c, cov)

    res_x = x[:: N / 64]
    res_y, res_y_err = b.eval_dep_yerr_vector(res_x)
    # res_y = b.eval_dep_vector(res_x)

    print res_y
    pylab.plot(x, y, "-")
    pylab.errorbar(res_x, res_y, fmt="g-", xerr=res_y_err)
예제 #4
0
파일: bspline3.py 프로젝트: pygsl/pygsl
def run():
    N = 1024
    x = numx.arange(N) * (numx.pi * 2 / N)
    y = numx.sin(x)

    b = bspline(4, nbreak)
    k = b.get_internal_knots()
    pygsl.set_debug_level(10)
    b.knots(k)
    X = b.eval_vector(x)
    c, cov, chisq = multifit.linear(X, y)

    b.set_coefficients_and_covariance_matrix(c, cov)

    res_x = x[::N / 64]
    res_y, res_y_err = b.eval_dep_yerr_vector(res_x)
    #res_y = b.eval_dep_vector(res_x)

    print(res_y)
    pylab.plot(x, y, '-')
    pylab.errorbar(res_x, res_y, fmt='g-', xerr=res_y_err)
예제 #5
0
 def test_linear(self):
     c, cov, chisq = multifit.linear(self.X, self.y, self.ws)
     assert(Numeric.absolute(c[0] - self.a) < self._eps)
     assert(Numeric.absolute(c[1] - self.b) < self._eps)
예제 #6
0
 def test_linear(self):
     c, cov, chisq = multifit.linear(self.X, self.y, self.ws)
     assert (Numeric.absolute(c[0] - self.a) < self._eps)
     assert (Numeric.absolute(c[1] - self.b) < self._eps)