Skip to content

Commit 088855b

Browse files
committed
Fixed #1123 Add missing Returns section in docstrings
1 parent 6f0169a commit 088855b

File tree

11 files changed

+229
-29
lines changed

11 files changed

+229
-29
lines changed

docstring.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ def get_docstring_args(fd, file_name, func_name, class_name=None):
2323
msg += f"function/method: {func_name}\n"
2424
raise RuntimeError(msg)
2525

26-
if class_name is None:
27-
params_section = re.findall(
28-
r"(?<=Parameters)(.*)(?=Returns)", docstring, re.DOTALL
29-
)[0]
30-
else:
31-
params_section = re.findall(r"(?<=Parameters)(.*)", docstring, re.DOTALL)[0]
26+
params_section = re.findall(
27+
r"(?<=Parameters)(.*)(?=Returns)", docstring, re.DOTALL
28+
)[0]
3229

3330
args = re.findall(r"(\w+)\s+\:", params_section)
3431
args = set([a for a in args if a != "i"]) # `i` should never be a parameter

stumpy/aamp_stimp.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ def __init__(
189189
The p-norm to apply for computing the Minkowski distance. Minkowski distance
190190
is typically used with `p` being 1 or 2, which correspond to the Manhattan
191191
distance and the Euclidean distance, respectively.
192+
193+
Returns
194+
-------
195+
None
192196
"""
193197
self._T = T.copy()
194198
self._T_min = np.min(self._T[np.isfinite(self._T)])
@@ -228,6 +232,10 @@ def update(self):
228232
----------
229233
None
230234
235+
Returns
236+
-------
237+
None
238+
231239
Notes
232240
-----
233241
`DOI: 10.1109/ICBK.2019.00031 \
@@ -290,7 +298,9 @@ def pan(self, threshold=0.2, normalize=True, contrast=True, binary=True, clip=Tr
290298
291299
Returns
292300
-------
293-
None
301+
PAN : numpy.ndarray
302+
The transformed (i.e., normalized, contrasted, binarized, and repeated)
303+
pan matrix profile
294304
"""
295305
PAN = self._PAN.copy()
296306
# Retrieve the row indices where the matrix profile was actually computed
@@ -334,6 +344,12 @@ def PAN_(self):
334344
Parameters
335345
----------
336346
None
347+
348+
Returns
349+
-------
350+
out : numpy.ndarray
351+
The transformed (i.e., normalized, contrasted, binarized, and repeated) pan
352+
matrix profile
337353
"""
338354
return self.pan().astype(np.float64)
339355

@@ -345,6 +361,12 @@ def M_(self):
345361
Parameters
346362
----------
347363
None
364+
365+
Returns
366+
-------
367+
out : numpy.ndarray
368+
The full list of (breadth first search (level) ordered) subsequence window
369+
sizes
348370
"""
349371
return self._M.astype(np.int64)
350372

@@ -360,7 +382,9 @@ def P_(self):
360382
361383
Returns
362384
-------
363-
None
385+
P : list of numpy.ndarray
386+
A list of all of the raw (i.e., non-transformed) matrix profiles matrix
387+
profile in (breadth first searched (level) ordered)
364388
"""
365389
P = []
366390
for i, idx in enumerate(self._bfs_indices):
@@ -491,6 +515,10 @@ def __init__(
491515
The p-norm to apply for computing the Minkowski distance. Minkowski distance
492516
is typically used with `p` being 1 or 2, which correspond to the Manhattan
493517
distance and the Euclidean distance, respectively.
518+
519+
Returns
520+
-------
521+
None
494522
"""
495523
super().__init__(
496524
T,
@@ -597,6 +625,10 @@ def __init__(
597625
The p-norm to apply for computing the Minkowski distance. Minkowski distance
598626
is typically used with `p` being 1 or 2, which correspond to the Manhattan
599627
distance and the Euclidean distance, respectively.
628+
629+
Returns
630+
-------
631+
None
600632
"""
601633
super().__init__(
602634
T,

stumpy/aampi.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ def __init__(self, T, m, egress=True, p=2.0, k=1, mp=None):
109109
corresponding indices. The last two columns correspond to the top-1 left
110110
and top-1 right matrix profile indices. When None (default), this array is
111111
computed internally using `stumpy.aamp`.
112+
113+
Returns
114+
-------
115+
None
112116
"""
113117
self._T = core._preprocess(T)
114118
core.check_window_size(m, max_size=self._T.shape[0])
@@ -179,6 +183,10 @@ def update(self, t):
179183
----------
180184
t : float
181185
A single new data point to be appended to `T`
186+
187+
Returns
188+
-------
189+
None
182190
183191
Notes
184192
-----
@@ -203,6 +211,10 @@ def _update_egress(self, t):
203211
----------
204212
t : float
205213
A single new data point to be appended to `T`
214+
215+
Returns
216+
-------
217+
None
206218
"""
207219
self._n = self._T.shape[0]
208220
l = self._n - self._m + 1 - 1 # Subtract 1 due to egress
@@ -268,6 +280,10 @@ def _update(self, t):
268280
----------
269281
t : float
270282
A single new data point to be appended to `T`
283+
284+
Returns
285+
-------
286+
None
271287
"""
272288
self._n = self._T.shape[0]
273289
l = self._n - self._m + 1
@@ -331,6 +347,11 @@ def P_(self):
331347
Parameters
332348
----------
333349
None
350+
351+
Returns
352+
-------
353+
out : numpy.ndarray
354+
The (top-k) matrix profile
334355
"""
335356
if self._k == 1:
336357
return self._P.flatten().astype(np.float64)
@@ -348,6 +369,11 @@ def I_(self):
348369
Parameters
349370
----------
350371
None
372+
373+
Returns
374+
-------
375+
out : numpy.ndarray
376+
The (top-k) matrix profile indices
351377
"""
352378
if self._k == 1:
353379
return self._I.flatten().astype(np.int64)
@@ -362,6 +388,11 @@ def left_P_(self):
362388
Parameters
363389
----------
364390
None
391+
392+
Returns
393+
-------
394+
out : numpy.ndarray
395+
The (top-1) left matrix profile
365396
"""
366397
return self._left_P.astype(np.float64)
367398

@@ -373,6 +404,11 @@ def left_I_(self):
373404
Parameters
374405
----------
375406
None
407+
408+
Returns
409+
-------
410+
out : numpy.ndarray
411+
The (top-1) left matrix profile indices
376412
"""
377413
return self._left_I.astype(np.int64)
378414

@@ -384,5 +420,10 @@ def T_(self):
384420
Parameters
385421
----------
386422
None
423+
424+
Returns
425+
-------
426+
out : numpy.ndarray
427+
The time series
387428
"""
388429
return self._T

stumpy/floss.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ def __init__(
499499
`functools.partial`. Any subsequence with at least one np.nan/np.inf will
500500
automatically have its corresponding value set to False in this boolean
501501
array.
502+
503+
Returns
504+
-------
505+
None
502506
"""
503507
self._mp = copy.deepcopy(np.asarray(mp))
504508
self._T = copy.deepcopy(np.asarray(T))
@@ -608,6 +612,10 @@ def update(self, t):
608612
t : float
609613
A single new data point to be appended to `T`
610614
615+
Returns
616+
-------
617+
None
618+
611619
Notes
612620
-----
613621
DOI: 10.1109/ICDM.2017.21 \
@@ -702,7 +710,8 @@ def cac_1d_(self):
702710
703711
Returns
704712
-------
705-
None
713+
out : numpy.ndarray
714+
The 1-dimensional corrected arc curve (CAC_1D)
706715
"""
707716
return self._cac.astype(np.float64)
708717

@@ -717,7 +726,8 @@ def P_(self):
717726
718727
Returns
719728
-------
720-
None
729+
out : numpy.ndarray
730+
The matrix profile
721731
"""
722732
return self._mp[:, 0].astype(np.float64)
723733

@@ -736,7 +746,8 @@ def I_(self):
736746
737747
Returns
738748
-------
739-
None
749+
out : numpy.ndarray
750+
The (right) matrix profile indices
740751
"""
741752
# Comparing the right matrix profile index value with the self index
742753
# position (i.e., self._mp[:, 3] == np.arange(len(self._mp)) is avoided
@@ -759,6 +770,7 @@ def T_(self):
759770
760771
Returns
761772
-------
762-
None
773+
out : numpy.ndarray
774+
The time series
763775
"""
764776
return self._T.astype(np.float64)

stumpy/gpu_aamp_stimp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ def __init__(
102102
The p-norm to apply for computing the Minkowski distance. Minkowski distance
103103
is typically used with `p` being 1 or 2, which correspond to the Manhattan
104104
distance and the Euclidean distance, respectively.
105+
106+
Returns
107+
-------
108+
None
105109
"""
106110
super().__init__(
107111
T,

stumpy/gpu_stimp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ def __init__(
164164
function using `functools.partial``. Any subsequence with at least one
165165
``np.nan``/``np.inf`` will automatically have its corresponding value set
166166
to ``False`` in this boolean array.
167+
168+
Returns
169+
-------
170+
None
167171
"""
168172
super().__init__(
169173
T,

0 commit comments

Comments
 (0)