Skip to content

Commit 01e867c

Browse files
committed
Updated all astype calls to use np types
1 parent 10b2672 commit 01e867c

11 files changed

+29
-29
lines changed

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22

33
echo "y" | python -m pip uninstall stumpy
4-
python -m pip install .
4+
python -m pip install --use-feature=in-tree-build .
55
rm -rf stumpy.egg-info build dist __pycache__

stumpy/aamp_motifs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def aamp_motifs(
224224

225225
T, T_subseq_isfinite = core.preprocess_non_normalized(T[np.newaxis, :], m)
226226
T_squared = np.sum(core.rolling_window(T * T, m), axis=-1)
227-
P = P[np.newaxis, :].astype("float64")
227+
P = P[np.newaxis, :].astype(np.float64)
228228

229229
motif_distances, motif_indices = _aamp_motifs(
230230
T,

stumpy/aampdist_snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def aampdist_snippets(
231231
for i in range(k):
232232
mask = snippets_profiles[i] <= total_min
233233
snippets_fractions[i] = np.sum(mask) / total_min.shape[0]
234-
total_min = total_min - mask.astype(float)
234+
total_min = total_min - mask.astype(np.float64)
235235

236236
return (
237237
snippets,

stumpy/aampi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def __init__(self, T, m, excl_zone=None, egress=True):
9797
self._egress = egress
9898

9999
mp = aamp(self._T, self._m)
100-
self._P = mp[:, 0]
101-
self._I = mp[:, 1]
102-
self._left_I = mp[:, 2]
100+
self._P = mp[:, 0].astype(np.float64)
101+
self._I = mp[:, 1].astype(np.int64)
102+
self._left_I = mp[:, 2].astype(np.int64)
103103
self._left_P = np.empty(self._P.shape)
104104
self._left_P[:] = np.inf
105105

stumpy/floss.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _nnmark(I):
3333
3434
This is a fast and vectorized implementation of the nnmark algorithm.
3535
"""
36-
I = I.astype(int)
36+
I = I.astype(np.int64)
3737

3838
# Replace index values that are less than zero with its own positional index
3939
idx = np.argwhere(I < 0).flatten()
@@ -569,25 +569,25 @@ def cac_1d_(self):
569569
"""
570570
Get the updated 1-dimensional corrected arc curve (CAC_1D)
571571
"""
572-
return self._cac.astype(np.float)
572+
return self._cac.astype(np.float64)
573573

574574
@property
575575
def P_(self):
576576
"""
577577
Get the updated matrix profile
578578
"""
579-
return self._mp[:, 0].astype(np.float)
579+
return self._mp[:, 0].astype(np.float64)
580580

581581
@property
582582
def I_(self):
583583
"""
584584
Get the updated (right) matrix profile indices
585585
"""
586-
return self._mp[:, 3].astype(np.int)
586+
return self._mp[:, 3].astype(np.int64)
587587

588588
@property
589589
def T_(self):
590590
"""
591591
Get the updated time series, `T`
592592
"""
593-
return self._T.astype(np.float)
593+
return self._T.astype(np.float64)

stumpy/motifs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def motifs(
233233
cutoff = max(np.mean(P) - 2 * np.std(P), np.min(P))
234234

235235
T, M_T, Σ_T = core.preprocess(T[np.newaxis, :], m)
236-
P = P[np.newaxis, :].astype("float64")
236+
P = P[np.newaxis, :].astype(np.float64)
237237

238238
motif_distances, motif_indices = _motifs(
239239
T,

stumpy/scraamp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,25 +489,25 @@ def P_(self):
489489
"""
490490
Get the updated matrix profile
491491
"""
492-
return self._P[:, 0].astype(np.float)
492+
return self._P[:, 0].astype(np.float64)
493493

494494
@property
495495
def I_(self):
496496
"""
497497
Get the updated matrix profile indices
498498
"""
499-
return self._I[:, 0].astype(np.int)
499+
return self._I[:, 0].astype(np.int64)
500500

501501
@property
502502
def left_I_(self):
503503
"""
504504
Get the updated left matrix profile indices
505505
"""
506-
return self._I[:, 1].astype(np.int)
506+
return self._I[:, 1].astype(np.int64)
507507

508508
@property
509509
def right_I_(self):
510510
"""
511511
Get the updated right matrix profile indices
512512
"""
513-
return self._I[:, 2].astype(np.int)
513+
return self._I[:, 2].astype(np.int64)

stumpy/scrump.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,25 +519,25 @@ def P_(self):
519519
"""
520520
Get the updated matrix profile
521521
"""
522-
return self._P[:, 0].astype(np.float)
522+
return self._P[:, 0].astype(np.float64)
523523

524524
@property
525525
def I_(self):
526526
"""
527527
Get the updated matrix profile indices
528528
"""
529-
return self._I[:, 0].astype(np.int)
529+
return self._I[:, 0].astype(np.int64)
530530

531531
@property
532532
def left_I_(self):
533533
"""
534534
Get the updated left matrix profile indices
535535
"""
536-
return self._I[:, 1].astype(np.int)
536+
return self._I[:, 1].astype(np.int64)
537537

538538
@property
539539
def right_I_(self):
540540
"""
541541
Get the updated right matrix profile indices
542542
"""
543-
return self._I[:, 2].astype(np.int)
543+
return self._I[:, 2].astype(np.int64)

stumpy/snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def snippets(
240240
for i in range(k):
241241
mask = snippets_profiles[i] <= total_min
242242
snippets_fractions[i] = np.sum(mask) / total_min.shape[0]
243-
total_min = total_min - mask.astype(float)
243+
total_min = total_min - mask.astype(np.float64)
244244

245245
return (
246246
snippets,

stumpy/stimp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ def _bfs_indices(n):
2222
The breadth first search (level order) indices
2323
"""
2424
if n == 1: # pragma: no cover
25-
return np.array([0], dtype=np.int32)
25+
return np.array([0], dtype=np.int64)
2626

27-
nlevel = np.floor(np.log2(n) + 1).astype(int)
27+
nlevel = np.floor(np.log2(n) + 1).astype(np.int64)
2828
nindices = np.power(2, np.arange(nlevel))
2929
cumsum_nindices = np.cumsum(nindices)
3030
nindices[-1] = n - cumsum_nindices[np.searchsorted(cumsum_nindices, n) - 1]
3131

32-
indices = np.empty((2, nindices.max()), dtype=np.int32)
32+
indices = np.empty((2, nindices.max()), dtype=np.int64)
3333
indices[0, 0] = 0
3434
indices[1, 0] = n
35-
tmp_indices = np.empty((2, 2 * nindices.max()), dtype=np.int32)
35+
tmp_indices = np.empty((2, 2 * nindices.max()), dtype=np.int64)
3636

37-
out = np.empty(n, dtype=np.int32)
37+
out = np.empty(n, dtype=np.int64)
3838
out_idx = 0
3939

4040
for nidx in nindices:

stumpy/stumpi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def __init__(self, T, m, excl_zone=None, egress=True, normalize=True):
110110
self._egress = egress
111111

112112
mp = stump(self._T, self._m)
113-
self._P = mp[:, 0]
114-
self._I = mp[:, 1]
115-
self._left_I = mp[:, 2]
113+
self._P = mp[:, 0].astype(np.float64)
114+
self._I = mp[:, 1].astype(np.int64)
115+
self._left_I = mp[:, 2].astype(np.int64)
116116
self._left_P = np.empty(self._P.shape)
117117
self._left_P[:] = np.inf
118118

0 commit comments

Comments
 (0)