本文整理汇总了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)
示例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)
示例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)