Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions fastdtw/fastdtw.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def __norm(p):


def __fastdtw(x, y, radius, dist):
if not np.issubdtype(x.dtype, np.floating) or not np.issubdtype(y.dtype, np.floating):
return dtw(x, y, dist=dist)

min_time_size = radius + 2

if len(x) < min_time_size or len(y) < min_time_size:
Expand All @@ -76,8 +79,8 @@ def __fastdtw(x, y, radius, dist):


def __prep_inputs(x, y, dist):
x = np.asanyarray(x, dtype='float')
y = np.asanyarray(y, dtype='float')
x = np.asanyarray(x, dtype='str' if isinstance(y[0], str) else 'float')
y = np.asanyarray(y, dtype='str' if isinstance(y[0], str) else 'float')

if x.ndim == y.ndim > 1 and x.shape[1] != y.shape[1]:
raise ValueError('second dimension of x and y must be the same')
Expand Down