Skip to content

Commit

Permalink
Merge pull request #7 from mluacnunes/main
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
dmfolgado authored Apr 20, 2022
2 parents 22af307 + e8e2cd9 commit 8318ad2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ dmypy.json

*.pdf

# documentation
docs/_twed.py
docs/_lcss.py
docs/_dtw.py
2 changes: 1 addition & 1 deletion tests/test_segmentation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from tssearch import load_ecg_example, get_distance_dict, time_series_segmentation, get_distances_by_type
from tssearch import load_ecg_example, get_distance_dict, time_series_segmentation


def segmentation():
Expand Down
2 changes: 1 addition & 1 deletion tssearch/distances/distances.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"parameters": {
"nu": 1e-3,
"lmbda": 0,
"degree": 2,
"p": 2,
"time": "true"
},
"use": "yes"
Expand Down
2 changes: 1 addition & 1 deletion tssearch/distances/elastic_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def twed(x, y, tx, ty, nu=0.001, lmbda=1.0, p=2, report="distance"):
# Keep data points in both time series
C[2] = (
ac[i - 1, j - 1]
+ dlp(query[i], sequence[j], degree)
+ dlp(query[i], sequence[j], p)
+ dlp(query[i - 1], sequence[j - 1], p)
+ nu * (abs(tq[i] - ts[j]) + abs(tq[i - 1] - ts[j - 1]))
)
Expand Down
11 changes: 0 additions & 11 deletions tssearch/utils/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@ def plot_alignment(ref_signal, estimated_signal, path, **kwargs):
for i in range(len(path[0]))[::step]
]

ref_pks = ni.peakdelta(copy_ref, 0.5)
est_pks = ni.peakdelta(estimated_signal, 0.5)

if len(ref_pks[0]) > 0 and len(ref_pks[0]) == len(est_pks[0]):
for i in range(len(ref_pks[0])):
plt.plot([ref_pks[0][i, 0], est_pks[0][i, 0]], [ref_pks[0][i, 1], est_pks[0][i, 1]], "red")

if len(ref_pks[1]) > 0 and len(ref_pks[1]) == len(est_pks[1]):
for i in range(len(ref_pks[1])):
plt.plot([ref_pks[1][i, 0], est_pks[1][i, 0]], [ref_pks[1][i, 1], est_pks[1][i, 1]], "red")


def plot_costmatrix(matrix, path):
"""
Expand Down

0 comments on commit 8318ad2

Please sign in to comment.