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)
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)
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)
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)
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)
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)