77import cubinterpp .cubinterpp_py as cubinterpp # cubinterpp_py is a pybind11 module
88
99
10- def get_test_data (case = 'akima ' , start = 1.0 , end = 5.0 , size = 8 ):
11- """ Generates test input data for Akima Spline tests """
12- if case == 'akima ' :
10+ def get_test_data (case = 'makima ' , start = 1.0 , end = 5.0 , size = 8 ):
11+ """ Generates test input data for Modified Akima Spline tests """
12+ if case == 'makima ' :
1313 return np .array ([1 , 2 , 3 , 4.0 , 5.0 , 5.5 , 7.0 , 8.0 , 9.0 , 9.5 , 10 ]), \
1414 np .array ([0 , 0 , 0 , 0.5 , 0.4 , 1.2 , 1.2 , 0.1 , 0.0 , 0.3 , 0.6 ])
1515
@@ -41,7 +41,7 @@ def get_test_data_2d(case='standard'):
4141 f = np .array ([[1.0 , 2.0 , 2.0 ],
4242 [2.0 , 3.0 , 3.0 ],
4343 [3.0 , 3.0 , 4.0 ]])
44- case 'akima ' :
44+ case 'makima ' :
4545 x = np .array ([1 , 2 , 3 , 4.0 , 5.0 , 5.5 , 7.0 , 8.0 , 9.0 , 9.5 , 10 ])
4646 y = np .array ([1 , 2 , 3 , 4.0 , 5.0 , 5.5 , 7.0 , 8.0 , 9.0 , 9.5 , 10 ])
4747 f = np .array ([[0 , 0 , 0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
@@ -79,16 +79,16 @@ def scipy_linear_interp(x, y, f, x_fine, y_fine):
7979 return interp2 ((x_grid , y_grid ))
8080
8181
82- def cubinterpp_interp2 (interp_type = 'linear' , data_case = 'akima ' , refinement = 50 ):
82+ def cubinterpp_interp2 (interp_type = 'linear' , data_case = 'makima ' , refinement = 50 ):
8383 """ Short hand for 2D interpolatino with cubinterpp """
8484 x , y , f = get_test_data_2d (case = data_case )
8585 match interp_type :
8686 case 'linear' :
8787 interp2 = cubinterpp .LinearInterp2D (x , y , f )
8888 case 'monotonic' :
8989 interp2 = cubinterpp .MonotonicSpline2D (x , y , f )
90- case 'akima ' :
91- interp2 = cubinterpp .AkimaSpline2D (x , y , f )
90+ case 'makima ' :
91+ interp2 = cubinterpp .MakimaSpline2D (x , y , f )
9292 case 'natural_spline' :
9393 interp2 = cubinterpp .NaturalSpline2D (x , y , f )
9494 x_fine , y_fine = refine_grid (x , refinement ), refine_grid (y , refinement )
@@ -103,7 +103,7 @@ def cubinterpp_interp2(interp_type='linear', data_case='akima', refinement=50):
103103def main ():
104104 """ Tets Cubic spline interpolation """
105105
106- x , y = get_test_data (case = 'akima ' )
106+ x , y = get_test_data (case = 'makima ' )
107107 x_fine = refine_grid (x )
108108
109109 spline = cubinterpp .LinearInterp1D (x , y )
@@ -112,23 +112,23 @@ def main():
112112 spline = cubinterpp .NaturalSpline1D (x , y )
113113 y_fine_natural = spline .evaln (x_fine )
114114
115- spline = cubinterpp .AkimaSpline1D (x , y )
116- y_fine_akima = spline .evaln (x_fine )
115+ spline = cubinterpp .MakimaSpline1D (x , y )
116+ y_fine_makima = spline .evaln (x_fine )
117117
118118 spline = cubinterpp .MonotonicSpline1D (x , y )
119119 y_fine_monotonic = spline .evaln (x_fine )
120120
121121 mpg .figure (title = 'Test figure' )
122122 mpg .plot (x_fine , y_fine_linear )
123123 mpg .plot (x_fine , y_fine_monotonic )
124- mpg .plot (x_fine , y_fine_akima )
124+ mpg .plot (x_fine , y_fine_makima )
125125 mpg .plot (x_fine , y_fine_natural )
126126 mpg .plot (x , y , width = 0 , symbol = 'o' , symbol_color = 'r' , symbol_size = 6 )
127127 mpg .gca ().grid = True
128128 mpg .legend (
129129 'Linear interpolation' ,
130130 'Monotonic cubic interpolation' ,
131- 'Akima spline' ,
131+ 'Modified Akima spline' ,
132132 'Natural cubic spline' ,
133133 'data points'
134134 )
@@ -138,7 +138,7 @@ def main():
138138 yp = np .tile (y , x .size )
139139 zp = f .flatten ()
140140
141- for interp_type in ('linear' , 'monotonic' , 'akima ' , 'natural_spline' ):
141+ for interp_type in ('linear' , 'monotonic' , 'makima ' , 'natural_spline' ):
142142 x_fine , y_fine , z_fine = cubinterpp_interp2 (
143143 interp_type = interp_type ,
144144 data_case = 'three_bumps' ,
0 commit comments