#NEWLINE# def test_derivatives_grid( self ) : #NEWLINE# #INDENT# x = array ( [ 1 , 2 , 3 , 4 , 5 ] ) #NEWLINE# y = array ( [ 1 , 2 , 3 , 4 , 5 ] ) #NEWLINE# z = array ( [ [ 1 , 2 , 1 , 2 , 1 ] , [ 1 , 2 , 1 , 2 , 1 ] , [ 1 , 2 , 3 , 2 , 1 ] , [ 1 , 2 , 2 , 2 , 1 ] , [ 1 , 2 , 1 , 2 , 1 ] ] ) #NEWLINE# dx = ( array ( [ [ 0 , 0 , ( - 20 ) , 0 , 0 ] , [ 0 , 0 , 13 , 0 , 0 ] , [ 0 , 0 , 4 , 0 , 0 ] , [ 0 , 0 , ( - 11 ) , 0 , 0 ] , [ 0 , 0 , 4 , 0 , 0 ] ] ) / 6.0 ) #NEWLINE# dy = array ( [ [ 4 , ( - 1 ) , 0 , 1 , ( - 4 ) ] , [ 4 , ( - 1 ) , 0 , 1 , ( - 4 ) ] , [ 0 , 1.5 , 0 , ( - 1.5 ) , 0 ] , [ 2 , 0.25 , 0 , ( - 0.25 ) , ( - 2 ) ] , [ 4 , ( - 1 ) , 0 , 1 , ( - 4 ) ] ] ) #NEWLINE# dxdy = ( array ( [ [ 40 , ( - 25 ) , 0 , 25 , ( - 40 ) ] , [ ( - 26 ) , 16.25 , 0 , ( - 16.25 ) , 26 ] , [ ( - 8 ) , 5 , 0 , ( - 5 ) , 8 ] , [ 22 , ( - 13.75 ) , 0 , 13.75 , ( - 22 ) ] , [ ( - 8 ) , 5 , 0 , ( - 5 ) , 8 ] ] ) / 6.0 ) #NEWLINE# lut = RectBivariateSpline ( x , y , z ) #NEWLINE# assert_array_almost_equal ( lut ( x , y , dx = 1 ) , dx ) #NEWLINE# assert_array_almost_equal ( lut ( x , y , dy = 1 ) , lut ) #NEWLINE# assert_array_almost_equal ( lut ( x , y , dx = 1 , dy = 1 ) , dxdy )