def test_with_plain_values(self):
        bidfm = BallInfoDataFilterModule()

        t = time.time()

        yu = [1300, 1200, 1100, 1000, 900]
        yv = [0, 10, 30, 45, 65]
        timestamps = [t, t+0.06, t+0.12, t+0.18, t+0.24]
        print "Result", bidfm.calculate_regression(yu, yv, timestamps, look_into_future=0.78)
    def test_uv_prediction(self):
        data = {}
        ballMock = PyMock()
        data["BallInfo"] = ballMock
        data["BallFound"] = True
        data[DATA_KEY_IS_NEW_FRAME] = True

        us = [(i/20.0)**3 for i in range(50)]
        vs = [(i/20.0)**2 for i in range(50)]
        time = range(50)

        us = us[0:30] + us[30:50]
        vs = vs[0:30] + vs[30:50]
        time = time[0:30] + time[30:50]

        us[30] = 10

        bidfm = BallInfoDataFilterModule()
        bidfm.start(data)

        predictions = []
        grades = []

        for i in range(len(us)):
            data["BallInfo"]._setSomething("u", us[i])
            data["BallInfo"]._setSomething("v", vs[i])
            data[DATA_KEY_CAMERA_CAPTURE_TIMESTAMP] = time[i]
            # Simplistic counter for increasing time

            # Call the module
            bidfm.update(data)

            self.assertTrue("uvprediction" in data[DATA_KEY_BALL_INFO_FILTERED])

            predictions.append(data[DATA_KEY_BALL_INFO_FILTERED]["uvprediction"])
            grades.append(data[DATA_KEY_BALL_INFO_FILTERED]["uvgrade"])



        if False:
            import matplotlib.pyplot as plt

            self.draw_first(predictions, us, vs, 1, 0, 50)
            # Draw the measured u value for this point in time

            #plt.plot(range(len(grades)), [math.sqrt(e[0]**2+e[1]**2) for e in grades], 'r-')

            # COMMENT - The red dots are the real u values measured,
            # the blue values the estimated values in 5 time steps
            # The green dotted lines are for better reading the u value
            # the Vertical lines describe when the estimation of u in 5 time steps is below zero

            plt.show()