@@ -96,20 +96,21 @@ def approx2(signal, pos0, pos1, method=INTERP.LINEAR, off_grid=0.0):
9696
9797def interp1d (x_interpolated , x_input , signal_input , method = INTERP .LINEAR , off_grid = 0.0 ):
9898 """
99- One-dimensional linear interpolation.Interpolation is performed along axis 0.
99+ One-dimensional linear interpolation.Interpolation is performed along axis 0
100+ of the input array.
100101
101102 Parameters
102103 ----------
103104
104- x : af.Array
105- The x-coordinates of the interpolated values . The interpolation function
106- is queried at these set of points.
105+ x_interpolated : af.Array
106+ The x-coordinates of the interpolation points . The interpolation
107+ function is queried at these set of points.
107108
108109 x : af.Array
109- The x-coordinates of the data points
110+ The x-coordinates of the input data points
110111
111112 signal_input: af.Array
112- Input signal array(uniform data )
113+ Input signal array (signal = f(x) )
113114
114115 method: optional: af.INTERP. default: af.INTERP.LINEAR.
115116 Interpolation method.
@@ -128,6 +129,56 @@ def interp1d(x_interpolated, x_input, signal_input, method=INTERP.LINEAR, off_gr
128129
129130 return approx1 (signal_input , pos0 , method , off_grid )
130131
132+
133+ def interp2d (x_interpolated , x_input , y_interpolated , y_input ,
134+ signal_input , method = INTERP .LINEAR , off_grid = 0.0
135+ ):
136+ """
137+ Two-dimensional linear interpolation.Interpolation is performed along axes 0 and 1
138+ of the input array.
139+
140+ Parameters
141+ ----------
142+
143+ x_interpolated : af.Array
144+ The x-coordinates of the interpolation points. The interpolation
145+ function is queried at these set of points.
146+
147+ x : af.Array
148+ The x-coordinates of the input data points. The convention followed is that
149+ the x-coordinates vary along axis 0
150+
151+ y_interpolated : af.Array
152+ The y-coordinates of the interpolation points. The interpolation
153+ function is queried at these set of points.
154+
155+ y : af.Array
156+ The y-coordinates of the input data points. The convention followed is that
157+ the y-coordinates vary along axis 1
158+
159+ signal_input: af.Array
160+ Input signal array (signal = f(x, y))
161+
162+ method: optional: af.INTERP. default: af.INTERP.LINEAR.
163+ Interpolation method.
164+
165+ off_grid: optional: scalar. default: 0.0.
166+ The value used for positions outside the range.
167+
168+ Returns
169+ -------
170+
171+ output: af.Array
172+ Values calculated at interpolation points.
173+ """
174+ dx = sum (x_input [1 , 0 , 0 , 0 ] - x_input [0 , 0 , 0 , 0 ])
175+ dy = sum (y_input [0 , 1 , 0 , 0 ] - y_input [0 , 0 , 0 , 0 ])
176+
177+ pos0 = (x_interpolated - sum (x_input [0 , 0 , 0 , 0 ]))/ dx
178+ pos1 = (y_interpolated - sum (y_input [0 , 0 , 0 , 0 ]))/ dy
179+
180+ return approx2 (signal_input , pos0 , pos1 , method , off_grid )
181+
131182def fft (signal , dim0 = None , scale = None ):
132183 """
133184 Fast Fourier Transform: 1D
0 commit comments