Skip to content

Commit 75a9d21

Browse files
committed
Updated docstrings to be more consistent, syntax highlighting
1 parent 97e5e5d commit 75a9d21

25 files changed

+946
-887
lines changed

docs/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
#rm -rf _build
4-
python -m sphinx -T -b html -d _build/doctrees -D language=en . _build/html
3+
rm -rf _build
4+
python -m sphinx -T -j auto -b html -d _build/doctrees -D language=en . _build/html
55
python -m http.server

docs/tutorials.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Tutorials
66
:target: https://mybinder.org/v2/gh/TDAmeritrade/stumpy/main?filepath=notebooks
77
:alt: Binder
88

9+
..
10+
The pipe, "|",below adds a line break and must be preceded and proceeded by a newline
11+
12+
|
13+
914
.. toctree::
1015
:maxdepth: 1
1116
:glob:

stumpy/aamp_ostinato.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def _aamp_ostinato(
170170
171171
device_id : int or list, default None
172172
The (GPU) device number to use. The default value is `0`. A list of
173-
valid device ids (int) may also be provided for parallel GPU-STUMP
173+
valid device ids (``int``) may also be provided for parallel GPU-STUMP
174174
computation. A list of all valid device ids can be obtained by
175175
executing `[device.id for device in numba.cuda.list_devices()]`.
176176

stumpy/aamp_stimp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class _aamp_stimp:
9191
9292
device_id : int or list, default None
9393
The (GPU) device number to use. The default value is `0`. A list of
94-
valid device ids (int) may also be provided for parallel GPU-STUMP
94+
valid device ids (``int``) may also be provided for parallel GPU-STUMP
9595
computation. A list of all valid device ids can be obtained by
9696
executing `[device.id for device in numba.cuda.list_devices()]`.
9797
@@ -178,7 +178,7 @@ def __init__(
178178
179179
device_id : int or list, default None
180180
The (GPU) device number to use. The default value is `0`. A list of
181-
valid device ids (int) may also be provided for parallel GPU-STUMP
181+
valid device ids (``int``) may also be provided for parallel GPU-STUMP
182182
computation. A list of all valid device ids can be obtained by
183183
executing `[device.id for device in numba.cuda.list_devices()]`.
184184

stumpy/aampi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class aampi:
3535
Note that this will increase the total computational time and memory usage
3636
when k > 1.
3737
38-
mp : numpy.ndarry, default None
38+
mp : numpy.ndarray, default None
3939
A pre-computed matrix profile (and corresponding matrix profile indices).
4040
This is a 2D array of shape `(len(T) - m + 1, 2 * k + 2)`, where the first `k`
4141
columns are top-k matrix profile, and the next `k` columns are their
@@ -102,7 +102,7 @@ def __init__(self, T, m, egress=True, p=2.0, k=1, mp=None):
102102
profile. Note that this will increase the total computational time and
103103
memory usage when k > 1.
104104
105-
mp : numpy.ndarry, default None
105+
mp : numpy.ndarray, default None
106106
A pre-computed matrix profile (and corresponding matrix profile indices).
107107
This is a 2D array of shape `(len(T) - m + 1, 2 * k + 2)`, where the first
108108
`k` columns are top-k matrix profile, and the next `k` columns are their

stumpy/chains.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ def atsc(IL, IR, j):
1111
"""
1212
Compute the anchored time series chain (ATSC)
1313
14-
Note that since the matrix profile indices, `IL` and `IR`, are pre-computed,
14+
Note that since the matrix profile indices, ``IL`` and ``IR``, are pre-computed,
1515
this function is agnostic to subsequence normalization.
1616
1717
Parameters
1818
----------
1919
IL : numpy.ndarray
20-
Left matrix profile indices
20+
Left matrix profile indices.
2121
2222
IR : numpy.ndarray
23-
Right matrix profile indices
23+
Right matrix profile indices.
2424
2525
j : int
26-
The index value for which to compute the ATSC
26+
The index value for which to compute the ATSC.
2727
2828
Returns
2929
-------
3030
out : numpy.ndarray
31-
Anchored time series chain for index, `j`
31+
Anchored time series chain for index, ``j``
3232
3333
See Also
3434
--------
@@ -76,27 +76,28 @@ def allc(IL, IR):
7676
"""
7777
Compute the all-chain set (ALLC)
7878
79-
Note that since the matrix profile indices, `IL` and `IR`, are pre-computed,
79+
Note that since the matrix profile indices, ``IL`` and ``IR``, are pre-computed,
8080
this function is agnostic to subsequence normalization.
8181
8282
Parameters
8383
----------
8484
IL : numpy.ndarray
85-
Left matrix profile indices
85+
Left matrix profile indices.
8686
8787
IR : numpy.ndarray
88-
Right matrix profile indices
88+
Right matrix profile indices.
8989
9090
Returns
9191
-------
9292
S : list(numpy.ndarray)
93-
All-chain set
93+
All-chain set.
9494
9595
C : numpy.ndarray
9696
Anchored time series chain for the longest chain (also known as the unanchored
9797
chain). Note that when there are multiple different chains with length equal to
98-
`len(C)`, then only one chain from this set is returned. You may iterate over
99-
the all-chain set, `S`, to find all other possible chains with length `len(C)`.
98+
``len(C)``, then only one chain from this set is returned. You may iterate over
99+
the all-chain set, ``S``, to find all other possible chains with length
100+
``len(C)``.
100101
101102
See Also
102103
--------
@@ -115,7 +116,7 @@ def allc(IL, IR):
115116
chain is simply the longest one among the all-chain set. Both the
116117
all-chain set and unanchored chain are returned.
117118
118-
The all-chain set, S, is returned as a list of unique numpy arrays.
119+
The all-chain set, ``S``, is returned as a list of unique numpy arrays.
119120
120121
Examples
121122
--------

stumpy/core.py

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,68 +1604,69 @@ def mass(
16041604
Parameters
16051605
----------
16061606
Q : numpy.ndarray
1607-
Query array or subsequence
1607+
Query array or subsequence.
16081608
16091609
T : numpy.ndarray
1610-
Time series or sequence
1610+
Time series or sequence.
16111611
16121612
M_T : numpy.ndarray, default None
1613-
Sliding mean of `T`
1613+
Sliding mean of ``T``.
16141614
16151615
Σ_T : numpy.ndarray, default None
1616-
Sliding standard deviation of `T`
1616+
Sliding standard deviation of ``T``.
16171617
16181618
normalize : bool, default True
1619-
When set to `True`, this z-normalizes subsequences prior to computing distances.
1620-
Otherwise, this function gets re-routed to its complementary non-normalized
1621-
equivalent set in the `@core.non_normalized` function decorator.
1619+
When set to ``True``, this z-normalizes subsequences prior to computing
1620+
distances. Otherwise, this function gets re-routed to its complementary
1621+
non-normalized equivalent set in the ``@core.non_normalized`` function
1622+
decorator.
16221623
16231624
p : float, default 2.0
16241625
The p-norm to apply for computing the Minkowski distance. This parameter is
1625-
ignored when `normalize == True`.
1626+
ignored when ``normalize == True``.
16261627
16271628
T_subseq_isfinite : numpy.ndarray, default None
1628-
A boolean array that indicates whether a subsequence in `T` contains a
1629-
`np.nan`/`np.inf` value (False). This parameter is ignored when
1630-
`normalize=True`.
1629+
A boolean array that indicates whether a subsequence in ``T`` contains a
1630+
``np.nan``/``np.inf`` value (``False``). This parameter is ignored when
1631+
``normalize == True``.
16311632
16321633
T_subseq_isconstant : numpy.ndarray or function, default None
1633-
A boolean array that indicates whether a subsequence in `T` is constant
1634-
(True). Alternatively, a custom, user-defined function that returns a
1635-
boolean array that indicates whether a subsequence in `T` is constant
1636-
(True). The function must only take two arguments, `a`, a 1-D array,
1637-
and `w`, the window size, while additional arguments may be specified
1638-
by currying the user-defined function using `functools.partial`. Any
1639-
subsequence with at least one np.nan/np.inf will automatically have its
1640-
corresponding value set to False in this boolean array.
1634+
A boolean array that indicates whether a subsequence in ``T`` is constant
1635+
(``True``). Alternatively, a custom, user-defined function that returns a
1636+
boolean array that indicates whether a subsequence in ``T`` is constant
1637+
(``True``). The function must only take two arguments, ``a``, a 1-D array,
1638+
and ``w``, the window size, while additional arguments may be specified
1639+
by currying the user-defined function using ``functools.partial``. Any
1640+
subsequence with at least one ``np.nan``/``np.inf`` will automatically have
1641+
its corresponding value set to ``False`` in this boolean array.
16411642
16421643
Q_subseq_isconstant : numpy.ndarray or function, default None
1643-
A boolean array that indicates whether the subsequence in `Q` is constant
1644-
(True). Alternatively, a custom, user-defined function that returns a
1645-
boolean array that indicates whether the subsequence in `Q` is constant
1646-
(True). The function must only take two arguments, `a`, a 1-D array,
1647-
and `w`, the window size, while additional arguments may be specified
1648-
by currying the user-defined function using `functools.partial`. Any
1649-
subsequence with at least one np.nan/np.inf will automatically have its
1650-
corresponding value set to False in this boolean array.
1644+
A boolean array that indicates whether the subsequence in ``Q`` is constant
1645+
(``True``). Alternatively, a custom, user-defined function that returns a
1646+
boolean array that indicates whether the subsequence in ``Q`` is constant
1647+
(``True``). The function must only take two arguments, ``a``, a 1-D array,
1648+
and ``w``, the window size, while additional arguments may be specified
1649+
by currying the user-defined function using ``functools.partial``. Any
1650+
subsequence with at least one ``np.nan``/``np.inf`` will automatically have
1651+
its corresponding value set to ``False`` in this boolean array.
16511652
16521653
query_idx : int, default None
1653-
This is the index position along the time series, `T`, where the query
1654-
subsequence, `Q`, is located. `query_idx` should be set to None if `Q`
1655-
is not a subsequence of `T`. If `Q` is a subsequence of `T`, provding
1656-
this argument is optional. If query_idx is provided, the distance
1657-
between Q and `T[query_idx : query_idx + m]` will automatically be set to
1654+
This is the index position along the time series, ``T``, where the query
1655+
subsequence, ``Q``, is located. ``query_idx`` should be set to ``None`` if
1656+
``Q`` is not a subsequence of ``T``. If ``Q`` is a subsequence of ``T``,
1657+
provding this argument is optional. If ``query_idx`` is provided, the distance
1658+
between ``Q`` and ``T[query_idx : query_idx + m]`` will automatically be set to
16581659
zero.
16591660
16601661
Returns
16611662
-------
16621663
distance_profile : numpy.ndarray
1663-
Distance profile
1664+
Distance profile.
16641665
16651666
See Also
16661667
--------
1667-
stumpy.motifs : Discover the top motifs for time series `T`
1668-
stumpy.match : Find all matches of a query `Q` in a time series `T```
1668+
stumpy.motifs : Discover the top motifs for time series ``T``
1669+
stumpy.match : Find all matches of a query ``Q`` in a time series ``T``
16691670
16701671
Notes
16711672
-----
@@ -1674,10 +1675,10 @@ def mass(
16741675
16751676
See Table II
16761677
1677-
Note that Q, T are not directly required to calculate D
1678+
Note that ``Q``, ``T`` are not directly required to calculate ``D``
16781679
1679-
Note: Unlike the Matrix Profile I paper, here, M_T, Σ_T can be calculated
1680-
once for all subsequences of T and passed in so the redundancy is removed
1680+
Note: Unlike the Matrix Profile I paper, here, ``M_T``, ``Σ_T`` can be calculated
1681+
once for all subsequences of ``T`` and passed in so the redundancy is removed
16811682
16821683
Examples
16831684
--------
@@ -2550,7 +2551,7 @@ def rolling_isconstant(a, w, a_subseq_isconstant=None):
25502551
w : numpy.ndarray
25512552
The rolling window size
25522553
2553-
a_subseq_isconstant : np.ndarray or function, default None
2554+
a_subseq_isconstant : numpy.ndarray or function, default None
25542555
A boolean array that indicates whether a subsequence in `a` is constant
25552556
(True). Alternatively, a custom, user-defined function that returns a
25562557
boolean array that indicates whether a subsequence in `a` is constant
@@ -2677,7 +2678,7 @@ def _get_partial_mp_func(mp_func, client=None, device_id=None):
26772678
26782679
device_id : int or list, default None
26792680
The (GPU) device number to use. The default value is `0`. A list of
2680-
valid device ids (int) may also be provided for parallel GPU-STUMP
2681+
valid device ids (``int``) may also be provided for parallel GPU-STUMP
26812682
computation. A list of all valid device ids can be obtained by
26822683
executing `[device.id for device in numba.cuda.list_devices()]`.
26832684
@@ -4067,7 +4068,7 @@ def _compute_P_ABBA(
40674068
40684069
device_id : int or list, default None
40694070
The (GPU) device number to use. The default value is `0`. A list of
4070-
valid device ids (int) may also be provided for parallel GPU-STUMP
4071+
valid device ids (``int``) may also be provided for parallel GPU-STUMP
40714072
computation. A list of all valid device ids can be obtained by
40724073
executing `[device.id for device in numba.cuda.list_devices()]`.
40734074
@@ -4172,7 +4173,7 @@ def _mpdist(
41724173
41734174
device_id : int or list, default None
41744175
The (GPU) device number to use. The default value is `0`. A list of
4175-
valid device ids (int) may also be provided for parallel GPU-STUMP
4176+
valid device ids (``int``) may also be provided for parallel GPU-STUMP
41764177
computation. A list of all valid device ids can be obtained by
41774178
executing `[device.id for device in numba.cuda.list_devices()]`.
41784179
@@ -4240,15 +4241,15 @@ def process_isconstant(T, m, T_subseq_isconstant, T_subseq_isfinite=None):
42404241
m : numpy.ndarray
42414242
The rolling window size
42424243
4243-
T_subseq_isconstant : np.ndarray, function, or list, default None
4244-
A parameter that is used to show whether a subsequence of a time series in `T`
4245-
is constant (True) or not. T_subseq_isconstant can be a 1D or 2D boolean
4246-
numpy.ndarry (depending on the dimension of `T`) or a function that can be
4247-
applied to each time series in `T`. Alternatively, for maximum flexibility, a
4248-
list (with length equal to the total number of time series) may also be used.
4249-
In this case, T_subseq_isconstant[i] corresponds to the i-th time series T[i]
4250-
and each element in the list can either be 1D boolean np.ndarray, a function,
4251-
or None.
4244+
T_subseq_isconstant : numpy.ndarray, function, or list, default None
4245+
A parameter that is used to show whether a subsequence of a time series in ``T``
4246+
is constant (``True``) or not. ``T_subseq_isconstant`` can be a 1D or 2D
4247+
boolean ``numpy.ndarray`` (depending on the dimension of ``T``) or a function
4248+
that can be applied to each time series in ``T``. Alternatively, for maximum
4249+
flexibility, a list (with length equal to the total number of time series) may
4250+
also be used. In this case, ``T_subseq_isconstant[i]`` corresponds to the
4251+
``i``-th time series ``T[i]`` and each element in the list can either be 1D
4252+
boolean ``numpy.ndarray``, a function, or ``None``.
42524253
42534254
T_subseq_isfinite : numpy.ndarray, default None
42544255
A boolean array that indicates whether a subsequence in `T` contains a

0 commit comments

Comments
 (0)