#!/usr/bin/env python # Author : Pierre Schnizer import unittest import pygsl from pygsl import fit from pygsl import multifit import pygsl._numobj as Numeric class FitTest(unittest.TestCase): _eps = 1e-8 def setUp(self): self.a = 1000.1 self.b = 100 self.x = Numeric.arange(100) self.y = self.a + self.b * self.x self.w = Numeric.ones(100) * 1000000 def test_0_linear(self): c0, c1, c00, c01, c10, sumsq = fit.linear(self.x, self.y) assert(Numeric.absolute(c0 - self.a)