def test_no_processing_on_no_new_frame_found(self):
        # Setup Data and Module under Test as well as call start
        data = {
            DATA_KEY_GOAL_FOUND: False,
            DATA_KEY_IS_NEW_FRAME: True
        }

        gpidfm = GoalPostInfoDataFilterModule()
        gpidfm.start(data)

        result = gpidfm.update(data)

        self.assertEqual(1, result)
    def test_k_means_with_goal_data_gathered_independently(self):
        # Setup Data and Module under Test as well as call start
        data = {
            DATA_KEY_GOAL_FOUND: True,
            DATA_KEY_IS_NEW_FRAME: True
        }

        gpidfm = GoalPostInfoDataFilterModule()
        gpidfm.start(data)

        if VIEW_PLOTS:

            for i in range(400):
                if random.random() > 0.9:
                    gp1u, gp1v = self.gauss(1875, 500), self.gauss(3250, 500)
                else:
                    gp1u, gp1v = self.gauss(4125, 500), self.gauss(3250, 500)

                data[DATA_KEY_GOAL_INFO] = {
                    0: GoalInfo(0, 0, gp1u, gp1v)
                }

                gpidfm.update(data)
                time.sleep(0.02)

                if i % 200 == 0:
                    x1, y1 = data["Centroids"][0]
                    x2, y2 = data["Centroids"][1]

                    us = [e[0] for e in gpidfm.k_means_list]
                    vs = [e[1] for e in gpidfm.k_means_list]

                    import matplotlib.pyplot as plt

                    plt.plot(us, vs, "bo", linewidth=2)
                    plt.plot(x1, y1, "rs", linewidth=3)
                    plt.plot(x2, y2, "gs", linewidth=3)
                    plt.axis('equal')
                    plt.show()


            time.sleep(0.2)

            for i in range(400):
                if random.random() > 0.9:
                    gp1u, gp1v = self.gauss(4000, 200), self.gauss(-1135, 200)
                else:
                    gp1u, gp1v = self.gauss(4000, 200), self.gauss(1135, 200)

                data[DATA_KEY_GOAL_INFO] = {
                    0: GoalInfo(0, 0, gp1u, gp1v)
                }

                gpidfm.update(data)
                time.sleep(0.02)

                if i % 200 == 0:
                    x1, y1 = data["Centroids"][0]
                    x2, y2 = data["Centroids"][1]

                    us = [e[0] for e in gpidfm.k_means_list]
                    vs = [e[1] for e in gpidfm.k_means_list]

                    import matplotlib.pyplot as plt

                    plt.plot(us, vs, "bo", linewidth=2)
                    plt.plot(x1, y1, "rs", linewidth=3)
                    plt.plot(x2, y2, "gs", linewidth=3)
                    plt.axis('equal')
                    plt.show()