def test_missing_window_indices(self): ts1 = [1, 100, 101, 200, 501, 502] ts2 = [300, 700] start_indices, end_indices = featurePipeline.make_past_window_indices( ts1, ts2, scale=100) self.assertEqual(start_indices[0], 4) self.assertEqual(start_indices[1], 6)
def test_window_indices_1ms_frames(self): ts1 = np.array( [1,1,1,3, 11,11,13]) ts2 = np.array( [1,3,11,13] ) start_indices, end_indices = featurePipeline.make_past_window_indices(ts1, ts2) expected_start_indices = np.array([0, 3, 4, 6]) self.assertTrue(vec_eq(start_indices, expected_start_indices)) expected_end_indices = np.array([3, 4, 6, 7]) self.assertTrue(vec_eq(expected_end_indices, end_indices))
def test_window_indices_boundaries(self): ts1 = [1, 100, 101, 200 ] ts2 = [100, 200] start_indices, end_indices = featurePipeline.make_past_window_indices(ts1, ts2, scale=100) print start_indices expected_start_indices = np.array( [0, 2] ) self.assertTrue(vec_eq(start_indices, expected_start_indices)) expected_end_indices = np.array( [2, 4] ) self.assertTrue(vec_eq(end_indices, expected_end_indices))
def test_window_indices_1ms_frames(self): ts1 = np.array([1, 1, 1, 3, 11, 11, 13]) ts2 = np.array([1, 3, 11, 13]) start_indices, end_indices = featurePipeline.make_past_window_indices( ts1, ts2) expected_start_indices = np.array([0, 3, 4, 6]) self.assertTrue(vec_eq(start_indices, expected_start_indices)) expected_end_indices = np.array([3, 4, 6, 7]) self.assertTrue(vec_eq(expected_end_indices, end_indices))
def test_window_indices_boundaries(self): ts1 = [1, 100, 101, 200] ts2 = [100, 200] start_indices, end_indices = featurePipeline.make_past_window_indices( ts1, ts2, scale=100) print start_indices expected_start_indices = np.array([0, 2]) self.assertTrue(vec_eq(start_indices, expected_start_indices)) expected_end_indices = np.array([2, 4]) self.assertTrue(vec_eq(end_indices, expected_end_indices))
def test_window_indices_100ms_frames(self): ts_1ms = np.array( [1, 2, 101, 102] ) ts_100ms = np.array( [100, 200]) start_indices, end_indices = featurePipeline.make_past_window_indices(ts_1ms, ts_100ms, scale=100) print start_indices, end_indices
def test_missing_window_indices(self): ts1 = [1, 100, 101, 200, 501, 502 ] ts2 = [300, 700] start_indices, end_indices = featurePipeline.make_past_window_indices(ts1, ts2, scale=100) self.assertEqual(start_indices[0], 4) self.assertEqual(start_indices[1], 6)
def test_window_indices_100ms_frames(self): ts_1ms = np.array([1, 2, 101, 102]) ts_100ms = np.array([100, 200]) start_indices, end_indices = featurePipeline.make_past_window_indices( ts_1ms, ts_100ms, scale=100) print start_indices, end_indices