Skip to content

Commit 330ba1d

Browse files
committed
Add note
1 parent 0bb072f commit 330ba1d

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

torch/signal/windows/__init__.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def add_docstr(function, docstr):
2929
Where `M` is the length of the window.
3030
""" +
3131
r"""
32-
32+
3333
Args:
3434
window_length (int): the length of the output window.
3535
In other words, the number of points of the cosine window.
@@ -54,7 +54,7 @@ def add_docstr(function, docstr):
5454
0.1564])
5555
5656
.. note::
57-
The window is normalized with the maximum value equal to 1, however, the 1 doesn't appear if `M` is even
57+
The window is normalized to 1 (maximum value is 1), however, the 1 doesn't appear if `M` is even
5858
and `periodic` is `False`.
5959
""".format(
6060
**factory_common_args
@@ -73,17 +73,17 @@ def add_docstr(function, docstr):
7373
w(n) = \exp{\left(-\frac{|n - center|}{\tau}\right)}
7474
""" +
7575
r"""
76-
76+
7777
Args:
78-
window_length (int): the length of the output window.
78+
window_length (int): the length of the output window.
7979
In other words, the number of points of the ee window.
8080
periodic (bool, optional): If `True`, returns a periodic window suitable for use in spectral analysis.
8181
If `False`, returns a symmetric window suitable for use in filter design. Default: `True`.
8282
center (float, optional): his value defines where the center of the window will be located.
8383
In other words, at which sample the peak of the window can be found.
8484
Default: `window_length / 2` if `periodic` is `True` (default), else `(window_length - 1) / 2`.
85-
tau (float, optional): the decay value.
86-
For `center = 0`, it's suggested to use :math:`\tau = -\frac{(M - 1)}{\ln(x)}`,
85+
tau (float, optional): the decay value.
86+
For `center = 0`, it's suggested to use :math:`\tau = -\frac{(M - 1)}{\ln(x)}`,
8787
if `x` is the fraction of the window remaining at the end. Default: 1.0.
8888
""" +
8989
r"""
@@ -104,6 +104,10 @@ def add_docstr(function, docstr):
104104
>>> torch.signal.windows.exponential(10,periodic=False,tau=.5)
105105
tensor([1.2341e-04, 9.1188e-04, 6.7379e-03, 4.9787e-02, 3.6788e-01, 3.6788e-01,
106106
4.9787e-02, 6.7379e-03, 9.1188e-04, 1.2341e-04])
107+
108+
.. note::
109+
The window is normalized to 1 (maximum value is 1), however, the 1 doesn't appear if `M` is even
110+
and `periodic` is `False`.
107111
""".format(
108112
**factory_common_args
109113
),
@@ -120,7 +124,7 @@ def add_docstr(function, docstr):
120124
w(n) = \exp{\left(-\left(\frac{n}{2\sigma}\right)^2\right)}
121125
""" +
122126
r"""
123-
127+
124128
Args:
125129
window_length (int): the length of the output window.
126130
In other words, the number of points of the cosine window.
@@ -145,6 +149,10 @@ def add_docstr(function, docstr):
145149
>>> torch.signal.windows.gaussian(10,periodic=False,std=0.9)
146150
tensor([3.7267e-06, 5.1998e-04, 2.1110e-02, 2.4935e-01, 8.5700e-01, 8.5700e-01,
147151
2.4935e-01, 2.1110e-02, 5.1998e-04, 3.7267e-06])
152+
153+
.. note::
154+
The window is normalized to 1 (maximum value is 1), however, the 1 doesn't appear if `M` is even
155+
and `periodic` is `False`.
148156
""".format(
149157
**factory_common_args
150158
),

torch/signal/windows/windows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def cosine(window_length: int,
8888

8989
start = .5
9090
k = torch.arange(start,
91-
start+window_length,
91+
start + window_length,
9292
dtype=dtype,
9393
layout=layout,
9494
device=device,

0 commit comments

Comments
 (0)