Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 718b8fc

Browse files
shyams2pavanky
authored andcommitted
Shortened variable names
1 parent 7709bb3 commit 718b8fc

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

arrayfire/signal.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _scale_pos_axis1(y_curr, y_orig):
2727
dy = y_orig[0, 1, 0, 0] - y0
2828
return((y_curr - y0) / dy)
2929

30-
def approx1(signal, x_interpolated, method=INTERP.LINEAR, off_grid=0.0, x_input = None):
30+
def approx1(signal, x, method=INTERP.LINEAR, off_grid=0.0, xp = None):
3131
"""
3232
Interpolate along a single dimension.Interpolation is performed along axis 0
3333
of the input array.
@@ -38,18 +38,18 @@ def approx1(signal, x_interpolated, method=INTERP.LINEAR, off_grid=0.0, x_input
3838
signal: af.Array
3939
Input signal array (signal = f(x))
4040
41-
x_interpolated : af.Array
42-
The x-coordinates of the interpolation points. The interpolation
43-
function is queried at these set of points.
41+
x: af.Array
42+
The x-coordinates of the interpolation points. The interpolation
43+
function is queried at these set of points.
4444
4545
method: optional: af.INTERP. default: af.INTERP.LINEAR.
4646
Interpolation method.
4747
4848
off_grid: optional: scalar. default: 0.0.
4949
The value used for positions outside the range.
5050
51-
x_input : af.Array
52-
The x-coordinates of the input data points
51+
xp : af.Array
52+
The x-coordinates of the input data points
5353
5454
Returns
5555
-------
@@ -67,17 +67,17 @@ def approx1(signal, x_interpolated, method=INTERP.LINEAR, off_grid=0.0, x_input
6767

6868
output = Array()
6969

70-
if(x_input is not None):
71-
pos0 = _scale_pos_axis0(x_interpolated, x_input)
70+
if(xp is not None):
71+
pos0 = _scale_pos_axis0(x, xp)
7272
else:
73-
pos0 = x_interpolated
73+
pos0 = x
7474

7575
safe_call(backend.get().af_approx1(c_pointer(output.arr), signal.arr, pos0.arr,
7676
method.value, c_float_t(off_grid)))
7777
return output
7878

79-
def approx2(signal, x_interpolated, y_interpolated,
80-
method=INTERP.LINEAR, off_grid=0.0, x_input = None, y_input = None
79+
def approx2(signal, x, y,
80+
method=INTERP.LINEAR, off_grid=0.0, xp = None, yp = None
8181
):
8282
"""
8383
Interpolate along a two dimension.Interpolation is performed along axes 0 and 1
@@ -89,28 +89,28 @@ def approx2(signal, x_interpolated, y_interpolated,
8989
signal: af.Array
9090
Input signal array (signal = f(x, y))
9191
92-
x_interpolated : af.Array
93-
The x-coordinates of the interpolation points. The interpolation
94-
function is queried at these set of points.
92+
x : af.Array
93+
The x-coordinates of the interpolation points. The interpolation
94+
function is queried at these set of points.
9595
9696
97-
y_interpolated : af.Array
98-
The y-coordinates of the interpolation points. The interpolation
99-
function is queried at these set of points.
97+
y : af.Array
98+
The y-coordinates of the interpolation points. The interpolation
99+
function is queried at these set of points.
100100
101101
method: optional: af.INTERP. default: af.INTERP.LINEAR.
102102
Interpolation method.
103103
104104
off_grid: optional: scalar. default: 0.0.
105105
The value used for positions outside the range.
106106
107-
x_input : af.Array
108-
The x-coordinates of the input data points. The convention followed is that
109-
the x-coordinates vary along axis 0
107+
xp : af.Array
108+
The x-coordinates of the input data points. The convention followed is that
109+
the x-coordinates vary along axis 0
110110
111-
y_input : af.Array
112-
The y-coordinates of the input data points. The convention followed is that
113-
the y-coordinates vary along axis 1
111+
yp : af.Array
112+
The y-coordinates of the input data points. The convention followed is that
113+
the y-coordinates vary along axis 1
114114
115115
Returns
116116
-------
@@ -129,15 +129,15 @@ def approx2(signal, x_interpolated, y_interpolated,
129129

130130
output = Array()
131131

132-
if(x_input is not None):
133-
pos0 = _scale_pos_axis0(x_interpolated, x_input)
132+
if(xp is not None):
133+
pos0 = _scale_pos_axis0(x, xp)
134134
else:
135-
pos0 = x_interpolated
135+
pos0 = x
136136

137-
if(y_input is not None):
138-
pos1 = _scale_pos_axis1(y_interpolated, y_input)
137+
if(yp is not None):
138+
pos1 = _scale_pos_axis1(y, yp)
139139
else:
140-
pos1 = y_interpolated
140+
pos1 = y
141141

142142
safe_call(backend.get().af_approx2(c_pointer(output.arr), signal.arr,
143143
pos0.arr, pos1.arr, method.value, c_float_t(off_grid)))

arrayfire/tests/simple/signal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ def simple_signal(verbose=False):
1818
signal = af.randu(10)
1919
x_new = af.randu(10)
2020
x_orig = af.randu(10)
21-
display_func(af.approx1(signal, x_new, x_input = x_orig))
21+
display_func(af.approx1(signal, x_new, xp = x_orig))
2222

2323
signal = af.randu(3, 3)
2424
x_new = af.randu(3, 3)
2525
x_orig = af.randu(3, 3)
2626
y_new = af.randu(3, 3)
2727
y_orig = af.randu(3, 3)
2828

29-
display_func(af.approx2(signal, x_new, y_new, x_input = x_orig, y_input = y_orig))
29+
display_func(af.approx2(signal, x_new, y_new, xp = x_orig, yp = y_orig))
3030

3131
a = af.randu(8, 1)
3232
display_func(a)

0 commit comments

Comments
 (0)