當前位置: 首頁>>代碼示例>>Python>>正文


Python LSQBivariateSpline.integral方法代碼示例

本文整理匯總了Python中scipy.interpolate.fitpack2.LSQBivariateSpline.integral方法的典型用法代碼示例。如果您正苦於以下問題:Python LSQBivariateSpline.integral方法的具體用法?Python LSQBivariateSpline.integral怎麽用?Python LSQBivariateSpline.integral使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy.interpolate.fitpack2.LSQBivariateSpline的用法示例。


在下文中一共展示了LSQBivariateSpline.integral方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_integral

# 需要導入模塊: from scipy.interpolate.fitpack2 import LSQBivariateSpline [as 別名]
# 或者: from scipy.interpolate.fitpack2.LSQBivariateSpline import integral [as 別名]
    def test_integral(self):
        x = [1,1,1,2,2,2,8,8,8]
        y = [1,2,3,1,2,3,1,2,3]
        z = array([0,7,8,3,4,7,1,3,4])

        s = 0.1
        tx = [1+s,3-s]
        ty = [1+s,3-s]
        lut = LSQBivariateSpline(x,y,z,tx,ty,kx=1,ky=1)
        tx, ty = lut.get_knots()

        tz = lut(tx, ty)
        trpz = .25*(diff(tx)[:,None]*diff(ty)[None,:]
                    * (tz[:-1,:-1]+tz[1:,:-1]+tz[:-1,1:]+tz[1:,1:])).sum()

        assert_almost_equal(lut.integral(tx[0], tx[-1], ty[0], ty[-1]), trpz)
開發者ID:NelleV,項目名稱:scipy,代碼行數:18,代碼來源:test_fitpack2.py

示例2: test_integral

# 需要導入模塊: from scipy.interpolate.fitpack2 import LSQBivariateSpline [as 別名]
# 或者: from scipy.interpolate.fitpack2.LSQBivariateSpline import integral [as 別名]
    def test_integral(self):
        x = [1, 1, 1, 2, 2, 2, 8, 8, 8]
        y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
        z = array([0, 7, 8, 3, 4, 7, 1, 3, 4])

        s = 0.1
        tx = [1 + s, 3 - s]
        ty = [1 + s, 3 - s]
        with warnings.catch_warnings(record=True):  # coefficients of the ...
            lut = LSQBivariateSpline(x, y, z, tx, ty, kx=1, ky=1)
        tx, ty = lut.get_knots()
        tz = lut(tx, ty)
        trpz = (
            0.25
            * (diff(tx)[:, None] * diff(ty)[None, :] * (tz[:-1, :-1] + tz[1:, :-1] + tz[:-1, 1:] + tz[1:, 1:])).sum()
        )

        assert_almost_equal(lut.integral(tx[0], tx[-1], ty[0], ty[-1]), trpz)
開發者ID:GiladAmar,項目名稱:scipy,代碼行數:20,代碼來源:test_fitpack2.py

示例3: test_integral

# 需要導入模塊: from scipy.interpolate.fitpack2 import LSQBivariateSpline [as 別名]
# 或者: from scipy.interpolate.fitpack2.LSQBivariateSpline import integral [as 別名]
    def test_integral(self):
        x = [1,1,1,2,2,2,8,8,8]
        y = [1,2,3,1,2,3,1,2,3]
        z = array([0,7,8,3,4,7,1,3,4])

        s = 0.1
        tx = [1+s,3-s]
        ty = [1+s,3-s]
        with suppress_warnings() as sup:
            r = sup.record(UserWarning, "\nThe coefficients of the spline")
            lut = LSQBivariateSpline(x, y, z, tx, ty, kx=1, ky=1)
            assert_equal(len(r), 1)
        tx, ty = lut.get_knots()
        tz = lut(tx, ty)
        trpz = .25*(diff(tx)[:,None]*diff(ty)[None,:]
                    * (tz[:-1,:-1]+tz[1:,:-1]+tz[:-1,1:]+tz[1:,1:])).sum()

        assert_almost_equal(lut.integral(tx[0], tx[-1], ty[0], ty[-1]),
                            trpz)
開發者ID:BranYang,項目名稱:scipy,代碼行數:21,代碼來源:test_fitpack2.py


注:本文中的scipy.interpolate.fitpack2.LSQBivariateSpline.integral方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。