Exemple #1
0
 def test_real_example(self):
     #test a more realistic dataframe, taken from a real run
     #TODO: match combo_prints and hulls bc currently y is different
     c_df = pd.read_pickle('tester hull.p')
     assign_print_numbers(c_df, 20)
     key = pd.read_csv('tester combo df.csv')
     combo_prints = create_combo_prints(c_df, 20, 1920)
     combo_prints.sort_values('print_numb', inplace=True)
     assert np.array_equal(
         combo_prints.astype('int').X.values.sort(), key.X.values.sort())
Exemple #2
0
 def test_front_hind_simple(self):
     f_h_df = pd.DataFrame({
         'X': [20, 30, 70],
         'Y': [300, 60, 210],
         'area': [50, 50, 50],
         'frame': [8, 9, 10],
         'print_numb': [3, 4, 5]
     })
     f_h_df['is_kept'] = True
     f_h_df = self.hulls_df.append(f_h_df, ignore_index=True)
     combo_prints = create_combo_prints(f_h_df, 5, 600)
     assert np.array_equal(combo_prints.is_hind,
                           [False, False, False, True, True])
Exemple #3
0
 def test_left_right_simple(self):
     f_h_df = pd.DataFrame({
         'X': [20, 30, 70, 20, 10],
         'Y': [300, 60, 210, 40, 60],
         'area': [50, 50, 50, 50, 50],
         'frame': [8, 9, 10, 10, 10],
         'print_numb': [3, 4, 5, 6, 7]
     })
     f_h_df['is_kept'] = True
     f_h_df = self.hulls_df.append(f_h_df, ignore_index=True)
     combo_prints = create_combo_prints(f_h_df, 5, 600)
     assert np.array_equal(
         combo_prints.sort_values(['print_numb']).is_right,
         [False, True, True, False, True, False, False])
Exemple #4
0
 def test_front_hind_w_scrambled_order(self):
     f_h_df = pd.DataFrame({
         'X': [20, 30, 70],
         'Y': [300, 60, 210],
         'area': [50, 50, 50],
         'frame': [10, 8, 9],
         'print_numb': [3, 4, 5]
     })
     f_h_df['is_kept'] = True
     f_h_df = self.hulls_df.append(f_h_df, ignore_index=True)
     combo_prints = create_combo_prints(f_h_df, 5, 600)
     assert np.array_equal(
         combo_prints.sort_values(['print_numb']).is_hind,
         [False, False, False, False, True])
Exemple #5
0
 def test_front_hind_same_frame_prints(self):
     f_h_df = pd.DataFrame({
         'X': [20, 30, 70, 20, 10],
         'Y': [300, 60, 210, 40, 60],
         'area': [50, 50, 50, 50, 50],
         'frame': [8, 9, 10, 10, 10],
         'print_numb': [3, 4, 5, 6, 7]
     })
     f_h_df['is_kept'] = True
     f_h_df = self.hulls_df.append(f_h_df, ignore_index=True)
     combo_prints = create_combo_prints(f_h_df, 5, 600)
     self.assertEqual(combo_prints.is_hind[5], True)
     self.assertEqual(combo_prints.is_hind[6], True)
     self.assertEqual(combo_prints.is_hind[7], False)
     self.assertEqual(combo_prints.is_hind[4], True)
Exemple #6
0
 def test_left_right_correct(self):
     combo_prints = create_combo_prints(self.hulls_df, 5, 600)
     assert np.array_equal(combo_prints.is_right, [False, True])
Exemple #7
0
 def test_frame_range_correct(self):
     combo_prints = create_combo_prints(self.hulls_df, 5, 600)
     assert np.array_equal(combo_prints.first_frame, [1, 5])
     assert np.array_equal(combo_prints.last_frame, [3, 7])
Exemple #8
0
 def test_info_is_from_hull_with_max_area(self):
     combo_prints = create_combo_prints(self.hulls_df, 5, 600)
     assert np.array_equal(combo_prints.max_area, [100, 300])
     assert np.array_equal(combo_prints.frame_max_a, [1, 6])
     assert np.array_equal(combo_prints.X, [400, 44])
     assert np.array_equal(combo_prints.Y, [40, 203])