示例#1
0
    def testPoly(self):
        fr = fit.polyfit(self.x, self.y, 1)
    
        print 'Poly: ', fr  # print polynomial coeffs
        self.checkitems([3.2, 0.35], fr, 1)

        fr = fit.polyfit(self.x, self.z, 2)
    
        print 'Poly: ', fr  # print polynomial coeffs
        self.checkitems([3.2, -12.2, 0.35], fr, 1)

        v = fit.polyval(fr, [0,1])
        print 'value is', dnp.abs(v-0.3)
        self.checkitems([0.1, -9], v, 1)
示例#2
0
 def testPolyVal(self):
     fr = fit.polyfit(self.x, self.y, 1)
     v = fit.polyval(fr, [0,1])
     print 'value is', dnp.abs(v-0.3)
     self.checkitems([0.36, 3.55], v, 0)