1- from math import sin , floor
2-
31import numpy as np
2+ from numpy import sin , floor
43import pytest
54from sympy import Float
65
@@ -93,8 +92,8 @@ def precompute_linear_interpolation(points, grid, origin, r=2):
9392
9493 Allow larger radius with zero weights for testing.
9594 """
96- gridpoints = [tuple (floor ((point [i ]- origin [i ])/ grid .spacing [i ])
97- for i in range (len (point ))) for point in points ]
95+ gridpoints = np . array ( [tuple (floor ((point [i ]- origin [i ])/ grid .spacing [i ])
96+ for i in range (len (point ))) for point in points ])
9897
9998 interpolation_coeffs = np .zeros ((len (points ), grid .dim , r ))
10099 rs = r // 2 - 1
@@ -114,13 +113,14 @@ def test_precomputed_interpolation(r):
114113 precomputed values for interpolation coefficients
115114 """
116115 shape = (101 , 101 )
117- points = [(.05 , .9 ), (.01 , .8 ), (0.07 , 0.84 )]
116+ points = np . array ( [(.05 , .9 ), (.01 , .8 ), (0.07 , 0.84 )])
118117 origin = (0 , 0 )
119118
120119 grid = Grid (shape = shape , origin = origin )
121120
122121 def init (data ):
123122 # This is data with halo so need to shift to match the m.data expectations
123+ print (grid .spacing )
124124 for i in range (data .shape [0 ]):
125125 for j in range (data .shape [1 ]):
126126 data [i , j ] = sin (grid .spacing [0 ]* (i - r )) + sin (grid .spacing [1 ]* (j - r ))
@@ -638,7 +638,7 @@ def test_msf_interpolate():
638638 with a TimeFunction
639639 """
640640 shape = (101 , 101 )
641- points = [(.05 , .9 ), (.01 , .8 ), (0.07 , 0.84 )]
641+ points = np . array ( [(.05 , .9 ), (.01 , .8 ), (0.07 , 0.84 )])
642642 origin = (0 , 0 )
643643
644644 grid = Grid (shape = shape , origin = origin )
0 commit comments