def e_spd(t1, t2, mdist, l_t1, l_t2, t2_dist): """ Usage ----- The spd-distance of trajectory t2 from trajectory t1 The spd-distance is the sum of the all the point-to-trajectory distance of points of t1 from trajectory t2 Parameters ---------- param t1 : l_t1 x 2 numpy_array param t2 : l_t2 x 2 numpy_array mdist : len(t1) x len(t2) numpy array, pairwise distance between points of trajectories t1 and t2 param l_t1: int, length of t1 param l_t2: int, length of t2 param t2_dist: l_t1 x 1 numpy_array, distances between consecutive points in t2 Returns ------- spd : float spd-distance of trajectory t2 from trajectory t1 """ spd = sum(map(lambda i1: point_to_trajectory(t1[i1], t2, mdist[i1], t2_dist, l_t2), range(l_t1))) / l_t1 return spd
def e_directed_hausdorff(t1, t2, mdist, l_t1, l_t2, t2_dist): """ Usage ----- directed hausdorff distance from trajectory t1 to trajectory t2. Parameters ---------- Parameters ---------- param t1 : l_t1 x 2 numpy_array param t2 : l_t2 x 2 numpy_array mdist : len(t1) x len(t2) numpy array, pairwise distance between points of trajectories t1 and t2 param l_t1: int, length of t1 param l_t2: int, length of t2 param t2_dist: l_t1 x 1 numpy_array, distances between consecutive points in t2 Returns ------- dh : float, directed hausdorff from trajectory t1 to trajectory t2 """ dh = max( map( lambda i1: point_to_trajectory(t1[i1], t2, mdist[i1], t2_dist, l_t2 ), range(l_t1))) return dh
def e_directed_hausdorff(t1, t2): """ Usage ----- directed hausdorff distance from trajectory t1 to trajectory t2. Parameters ---------- param t1 : len(t1)x2 numpy_array param t2 : len(t2)x2 numpy_array Returns ------- dh : float, directed hausdorff from trajectory t1 to trajectory t2 """ dh = max(map(lambda p: point_to_trajectory(p, t2), t1)) return dh
def e_directed_hausdorff (t1, t2): """ Usage ----- directed hausdorff distance from trajectory t1 to trajectory t2. Parameters ---------- param t1 : len(t1)x2 numpy_array param t2 : len(t2)x2 numpy_array Returns ------- dh : float, directed hausdorff from trajectory t1 to trajectory t2 """ dh=max(map(lambda p : point_to_trajectory(p,t2),t1)) return dh
def e_spd (t1, t2): """ Usage ----- The spd-distance of trajectory t2 from trajectory t1 The spd-distance is the sum of the all the point-to-trajectory distance of points of t1 from trajectory t2 Parameters ---------- param t1 : len(t1)x2 numpy_array param t2 : len(t2)x2 numpy_array Returns ------- spd : float spd-distance of trajectory t2 from trajectory t1 """ spd=sum(map(lambda p : point_to_trajectory(p,t2),t1))/len(t1) return spd