Пример #1
0
    def testPolyG(self):
        fr = fit.fit([fit.function.linear], self.x, self.y, [2.5, 0.8], [(0.1,4), (0.,1.7)], seed=123)
    
        print 'PolyG: ', fr  # print fit result
        self.checkitems([3.2, 0.35], fr.parameters, 0)

        fr = fit.fit([fit.function.quadratic], self.x, self.z, [2.5, -20., 0.8], [(0.1,4), (-40, 10), (0.,1.7)], seed=123)

        print 'PolyG: ', fr  # print fit result
        self.checkitems([3.2, -12.2, 0.4], fr.parameters, 1)
Пример #2
0
    def testPolyG(self):
        fr = fit.fit([fit.function.linear], self.x, self.y, [2.5, 0.8], [(0.1,4), (0.,1.7)], seed=123)
    
        print 'PolyG: ', fr  # print fit result
        self.checkitems([3.2, 0.35], fr.parameters, 0)

        fr = fit.fit([fit.function.quadratic], self.x, self.z, [2.5, -20., 0.8], [(0.1,4), (-40, 10), (0.,1.7)], seed=123)

        print 'PolyG: ', fr  # print fit result
        self.checkitems([3.2, -12.2, 0.4], fr.parameters, 1)
Пример #3
0
    def testFit(self):
        d = dnp.array([ 3.5733e+00, 2.1821e+00, 1.8313e+00, 1.9893e+00, 8.3145e-01,
            9.8761e-01, 7.1809e-01, 8.6756e-01, 2.3144e-01, 6.6659e-01, 3.8420e-01,
            3.2560e-01, 6.0712e-01, 5.0191e-01, 5.1308e-01, 2.8631e-01, 2.3811e-01,
            7.6472e-02, 2.1317e-01, 9.1819e-02 ])
        fr = fit.fit([myfunc, fit.function.offset], self.x, d, [2.5, 1.2, 0.1], [(0,4), 0, (-0.2,0.7)])
    
        print 'Fit: ', fr  # print fit result
        self.checkitems([3., 1.5], fr.parameters)

        fr = fit.fit([myfunc, fit.function.offset], self.x, d[:-1], [2.5, 1.2, 0.1], [(0,4), 0, (-0.2,0.7)])
Пример #4
0
    def testFit(self):
        d = dnp.array([ 3.5733e+00, 2.1821e+00, 1.8313e+00, 1.9893e+00, 8.3145e-01,
            9.8761e-01, 7.1809e-01, 8.6756e-01, 2.3144e-01, 6.6659e-01, 3.8420e-01,
            3.2560e-01, 6.0712e-01, 5.0191e-01, 5.1308e-01, 2.8631e-01, 2.3811e-01,
            7.6472e-02, 2.1317e-01, 9.1819e-02 ])
        fr = fit.fit([myfunc, fit.function.offset], self.x, d, [2.5, 1.2, 0.1], [(0,4), 0, (-0.2,0.7)])
    
        print 'Fit: ', fr  # print fit result
        self.checkitems([3., 1.5], fr.parameters)

        fr = fit.fit([myfunc, fit.function.offset], self.x[:-1], d[:-1], [2.5, 1.2, 0.1], [(0,4), 0, (-0.2,0.7)])
        fr = fit.fit(fit.function.offset, self.x, d, 0.3, (-0.2,1.7))
        print fr, fr.area, fr.residual
        fd = fr.makefuncdata()
        fp = fr.makeplotdata()
        return fr
Пример #5
0
    def testFit(self):
        d = dnp.array([ 3.5733e+00, 2.1821e+00, 1.8313e+00, 1.9893e+00, 8.3145e-01,
            9.8761e-01, 7.1809e-01, 8.6756e-01, 2.3144e-01, 6.6659e-01, 3.8420e-01,
            3.2560e-01, 6.0712e-01, 5.0191e-01, 5.1308e-01, 2.8631e-01, 2.3811e-01,
            7.6472e-02, 2.1317e-01, 9.1819e-02 ])
        fr = fit.fit([myfunc, fit.function.offset], self.x, d, [2.5, 1.2, 0.1], [(0,4), 0, (-0.2,0.7)])
    
        print('Fit: ', fr)  # print fit result
        self.checkitems([3., 1.5], fr.parameters)

        fr = fit.fit([myfunc, fit.function.offset], self.x[:-1], d[:-1], [2.5, 1.2, 0.1], [(0,4), 0, (-0.2,0.7)])
        fr = fit.fit(fit.function.offset, self.x, d, 0.3, (-0.2,1.7))
        print(fr, fr.area, fr.residual)
        fd = fr.makefuncdata()
        fp = fr.makeplotdata()
        return fr