def test_links_closer_of_two_tracks_in_space(self): tt1 = np.array([1, 3, 5, 7, 9]) xx1 = np.array([0, 1, 2, 3, 4]) yy1 = np.array([1, 2, 3, 4, 5]) track1 = Link.from_arrays(tt1, xx1, yy1) tt2 = np.array([1.5, 3.5, 5.5, 7.5, 9.5]) xx2 = np.array([0.5, 1.5, 2.5, 3.5, 4.5]) yy2 = np.array([1, 2, 3, 4, 5]) track2 = Link.from_arrays(tt2, xx2, yy2) tt3 = np.array([11, 13, 15, 17, 19]) xx3 = np.array([5, 6, 7, 8, 9]) yy3 = np.array([6, 7, 8, 9, 10]) track3 = Link.from_arrays(tt3, xx3, yy3) res = tracking_pipeline.link_nearby_tracks( [track1, track2, track3], max_track_lag=2.1, max_link_dist=2, min_track_len=5, ) exp = [track1, Link.join(track2, track3)] self.assertEqual(res, exp)
def test_doesnt_link_far_tracks_in_space(self): tt1 = np.array([1, 3, 5, 7, 9]) xx1 = np.array([0, 1, 2, 3, 4]) yy1 = np.array([1, 2, 3, 4, 5]) track1 = Link.from_arrays(tt1, xx1, yy1) tt2 = np.array([11, 13, 15, 17, 19]) xx2 = np.array([5, 6, 7, 8, 9]) yy2 = np.array([6, 7, 8, 9, 10]) track2 = Link.from_arrays(tt2, xx2, yy2) res = tracking_pipeline.link_nearby_tracks( [track1, track2], max_track_lag=2.1, max_link_dist=1, min_track_len=5, ) exp = [track1, track2] self.assertEqual(res, exp)