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)
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 = .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)
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)
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)
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)