def get_average_interpoint_R2_distance(self): """ """ points = self.get_R2_points() dists = [] for i in range(len(points) - 1): d = R2.distance(points[i], points[i + 1]) dists.append(d) return np.median(dists)
def process_compute_distances(processed): nmap = processed['nmap'] centroid = processed['centroid'] y_goal = processed['y_goal'] processed['p_distance'] = [R2.distance(p, centroid) for p in nmap.get_R2_points()] # ... for observations y_dist = lambda y0, y1: np.linalg.norm(y0 - y1) processed['y_distance'] = [y_dist(y, y_goal) for y in nmap.get_all_observations()] return processed