Skip to content

Commit 5c6570d

Browse files
committed
update docstring and change order
1 parent 3f2576e commit 5c6570d

File tree

1 file changed

+48
-47
lines changed

1 file changed

+48
-47
lines changed

dpnp/dpnp_iface_window.py

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ def _call_window_kernel(
8181
return result
8282

8383

84-
def blackman(M, device=None, usm_type=None, sycl_queue=None):
84+
def bartlett(M, device=None, usm_type=None, sycl_queue=None):
8585
r"""
86-
Return the Blackman window.
86+
Return the Bartlett window.
8787
88-
The Blackman window is a taper formed by using the first three terms of a
89-
summation of cosines. It was designed to have close to the minimal leakage
90-
possible. It is close to optimal, only slightly worse than a Kaiser window.
88+
The Bartlett window is very similar to a triangular window, except that the
89+
end points are at zero. It is often used in signal processing for tapering
90+
a signal, without generating too much ripple in the frequency domain.
9191
92-
For full documentation refer to :obj:`numpy.blackman`.
92+
For full documentation refer to :obj:`numpy.bartlett`.
9393
9494
Parameters
9595
----------
@@ -120,69 +120,70 @@ def blackman(M, device=None, usm_type=None, sycl_queue=None):
120120
Returns
121121
-------
122122
out : dpnp.ndarray of shape (M,)
123-
The window, with the maximum value normalized to one (the value one
124-
appears only if the number of samples is odd).
123+
The triangular window, with the maximum value normalized to one
124+
(the value one appears only if the number of samples is odd), with the
125+
first and last samples equal to zero.
125126
126127
See Also
127128
--------
128-
:obj:`dpnp.bartlett` : Return the Bartlett window.
129+
:obj:`dpnp.blackman` : Return the Blackman window.
129130
:obj:`dpnp.hamming` : Return the Hamming window.
130131
:obj:`dpnp.hanning` : Return the Hanning window.
131132
:obj:`dpnp.kaiser` : Return the Kaiser window.
132133
133134
Notes
134135
-----
135-
The Blackman window is defined as
136+
The Bartlett window is defined as
136137
137-
.. math:: w(n) = 0.42 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right)
138-
+ 0.08\cos\left(\frac{4\pi{n}}{M-1}\right)
138+
.. math:: w(n) = \frac{2}{M-1} \left(\frac{M-1}{2} -
139+
\left|n - \frac{M-1}{2}\right|\right)
139140
\qquad 0 \leq n \leq M-1
140141
141142
Examples
142143
--------
143144
>>> import dpnp as np
144-
>>> np.blackman(12)
145-
array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, 4.14397981e-01,
146-
7.36045180e-01, 9.67046769e-01, 9.67046769e-01, 7.36045180e-01,
147-
4.14397981e-01, 1.59903635e-01, 3.26064346e-02, -1.38777878e-17])
145+
>>> np.bartlett(12)
146+
array([0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273,
147+
0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636,
148+
0.18181818, 0. ])
148149
149150
Creating the output array on a different device or with a
150151
specified usm_type:
151152
152-
>>> x = np.blackman(3) # default case
153+
>>> x = np.bartlett(4) # default case
153154
>>> x, x.device, x.usm_type
154-
(array([-1.38777878e-17, 1.00000000e+00, -1.38777878e-17]),
155+
(array([0. , 0.66666667, 0.66666667, 0. ]),
155156
Device(level_zero:gpu:0),
156157
'device')
157158
158-
>>> y = np.blackman(3, device="cpu")
159+
>>> y = np.bartlett(4, device="cpu")
159160
>>> y, y.device, y.usm_type
160-
(array([-1.38777878e-17, 1.00000000e+00, -1.38777878e-17]),
161+
(array([0. , 0.66666667, 0.66666667, 0. ]),
161162
Device(opencl:cpu:0),
162163
'device')
163164
164-
>>> z = np.blackman(3, usm_type="host")
165+
>>> z = np.bartlett(4, usm_type="host")
165166
>>> z, z.device, z.usm_type
166-
(array([-1.38777878e-17, 1.00000000e+00, -1.38777878e-17]),
167+
(array([0. , 0.66666667, 0.66666667, 0. ]),
167168
Device(level_zero:gpu:0),
168169
'host')
169170
170171
"""
171172

172173
return _call_window_kernel(
173-
M, wi._blackman, device=device, usm_type=usm_type, sycl_queue=sycl_queue
174+
M, wi._bartlett, device=device, usm_type=usm_type, sycl_queue=sycl_queue
174175
)
175176

176177

177-
def bartlett(M, device=None, usm_type=None, sycl_queue=None):
178+
def blackman(M, device=None, usm_type=None, sycl_queue=None):
178179
r"""
179-
Return the Bartlett window.
180+
Return the Blackman window.
180181
181-
The Bartlett window is very similar to a triangular window, except that the
182-
end points are at zero. It is often used in signal processing for tapering
183-
a signal, without generating too much ripple in the frequency domain.
182+
The Blackman window is a taper formed by using the first three terms of a
183+
summation of cosines. It was designed to have close to the minimal leakage
184+
possible. It is close to optimal, only slightly worse than a Kaiser window.
184185
185-
For full documentation refer to :obj:`numpy.bartlett`.
186+
For full documentation refer to :obj:`numpy.blackman`.
186187
187188
Parameters
188189
----------
@@ -213,57 +214,57 @@ def bartlett(M, device=None, usm_type=None, sycl_queue=None):
213214
Returns
214215
-------
215216
out : dpnp.ndarray of shape (M,)
216-
The triangular window, with the maximum value normalized to one
217-
(the value one appears only if the number of samples is odd), with the
218-
first and last samples equal to zero.
217+
The window, with the maximum value normalized to one (the value one
218+
appears only if the number of samples is odd).
219219
220220
See Also
221221
--------
222-
:obj:`dpnp.blackman` : Return the Blackman window.
222+
:obj:`dpnp.bartlett` : Return the Bartlett window.
223223
:obj:`dpnp.hamming` : Return the Hamming window.
224224
:obj:`dpnp.hanning` : Return the Hanning window.
225225
:obj:`dpnp.kaiser` : Return the Kaiser window.
226226
227227
Notes
228228
-----
229-
The Bartlett window is defined as
229+
The Blackman window is defined as
230230
231-
.. math:: w(n) = \frac{2}{M-1} \left(\frac{M-1}{2} -
232-
\left|n - \frac{M-1}{2}\right|\right)
231+
.. math:: w(n) = 0.42 - 0.5\cos\left(\frac{2\pi{n}}{M-1}\right)
232+
+ 0.08\cos\left(\frac{4\pi{n}}{M-1}\right)
233+
\qquad 0 \leq n \leq M-1
233234
234235
Examples
235236
--------
236237
>>> import dpnp as np
237-
>>> np.bartlett(12)
238-
array([0. , 0.18181818, 0.36363636, 0.54545455, 0.72727273,
239-
0.90909091, 0.90909091, 0.72727273, 0.54545455, 0.36363636,
240-
0.18181818, 0. ])
238+
>>> np.blackman(12)
239+
array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, 4.14397981e-01,
240+
7.36045180e-01, 9.67046769e-01, 9.67046769e-01, 7.36045180e-01,
241+
4.14397981e-01, 1.59903635e-01, 3.26064346e-02, -1.38777878e-17])
241242
242243
Creating the output array on a different device or with a
243244
specified usm_type:
244245
245-
>>> x = np.bartlett(4) # default case
246+
>>> x = np.blackman(3) # default case
246247
>>> x, x.device, x.usm_type
247-
(array([0. , 0.66666667, 0.66666667, 0. ]),
248+
(array([-1.38777878e-17, 1.00000000e+00, -1.38777878e-17]),
248249
Device(level_zero:gpu:0),
249250
'device')
250251
251-
>>> y = np.bartlett(4, device="cpu")
252+
>>> y = np.blackman(3, device="cpu")
252253
>>> y, y.device, y.usm_type
253-
(array([0. , 0.66666667, 0.66666667, 0. ]),
254+
(array([-1.38777878e-17, 1.00000000e+00, -1.38777878e-17]),
254255
Device(opencl:cpu:0),
255256
'device')
256257
257-
>>> z = np.bartlett(4, usm_type="host")
258+
>>> z = np.blackman(3, usm_type="host")
258259
>>> z, z.device, z.usm_type
259-
(array([0. , 0.66666667, 0.66666667, 0. ]),
260+
(array([-1.38777878e-17, 1.00000000e+00, -1.38777878e-17]),
260261
Device(level_zero:gpu:0),
261262
'host')
262263
263264
"""
264265

265266
return _call_window_kernel(
266-
M, wi._bartlett, device=device, usm_type=usm_type, sycl_queue=sycl_queue
267+
M, wi._blackman, device=device, usm_type=usm_type, sycl_queue=sycl_queue
267268
)
268269

269270

0 commit comments

Comments
 (0)