Skip to content

Commit ce68f0a

Browse files
committed
add followup fixes for PR 38
1 parent dd092dd commit ce68f0a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

synctoolbox/dtw/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,16 @@ def find_anchor_indices_in_warping_path(warping_path: np.ndarray,
225225
226226
Returns
227227
-------
228-
indices : np.ndarray [shape=(2, M)]
228+
indices : np.ndarray [shape=(M,)]
229229
Anchor indices in the ``warping_path``
230230
"""
231231
indices = np.zeros(anchors.shape[1], dtype=int)
232232

233233
for k in range(anchors.shape[1]):
234234
a = anchors[:, k]
235235
anchor_indices = np.flatnonzero((a[0] == warping_path[0, :]) & (a[1] == warping_path[1, :]))
236+
if anchor_indices.size == 0:
237+
raise ValueError(f"Anchor {a.tolist()} not found in warping path")
236238
indices[k] = anchor_indices[0]
237239

238240
return indices

0 commit comments

Comments
 (0)