Ejemplo n.º 1
0
    def test_all(self):
        expected_mu = 10.9999
        expected_sig = 4.0059

        mu = 0.
        sig = 10000.
        measurement_sig, motion_sig = 4., 2.
        measurements = [5., 6., 7., 9., 10.]
        motion = [1., 1., 2., 1., 1.]
        
        f = KalmanFilter()
        mu, sig = f.run(measurements=measurements, motion=motion, 
                        measurement_sig=measurement_sig, motion_sig=motion_sig,
                        mu=mu, sig=sig)
        self.assertAlmostEqual(expected_mu, mu, places=4)
        self.assertAlmostEqual(expected_sig, sig, places=4)
Ejemplo n.º 2
0
    def test_all(self):
        expected_mu = 10.9999
        expected_sig = 4.0059

        mu = 0.
        sig = 10000.
        measurement_sig, motion_sig = 4., 2.
        measurements = [5., 6., 7., 9., 10.]
        motion = [1., 1., 2., 1., 1.]

        f = KalmanFilter()
        mu, sig = f.run(measurements=measurements,
                        motion=motion,
                        measurement_sig=measurement_sig,
                        motion_sig=motion_sig,
                        mu=mu,
                        sig=sig)
        self.assertAlmostEqual(expected_mu, mu, places=4)
        self.assertAlmostEqual(expected_sig, sig, places=4)
Ejemplo n.º 3
0
 def test_predict(self):
     f = KalmanFilter()
     mu, sigma2, nu, r2 = 10., 4., 12., 4.
     mu_prime, sigma2_prime = f.predict(mu=mu, nu=nu, sigma2=sigma2, r2=r2)
     self.assertAlmostEqual(22.0, mu_prime, places=1)
     self.assertAlmostEqual(8.0, sigma2_prime, places=1)
Ejemplo n.º 4
0
 def test_update(self):
     f = KalmanFilter()
     mu, sigma2, nu, r2 = 10., 8., 13., 2.
     mu_prime, sigma2_prime = f.update(mu=mu, nu=nu, sigma2=sigma2, r2=r2)
     self.assertAlmostEqual(12.4, mu_prime, places=1)
     self.assertAlmostEqual(1.6, sigma2_prime, places=1)
Ejemplo n.º 5
0
 def test_predict(self):
     f = KalmanFilter()
     mu, sigma2, nu, r2 = 10., 4., 12., 4.
     mu_prime, sigma2_prime = f.predict(mu=mu, nu=nu, sigma2=sigma2, r2=r2)
     self.assertAlmostEqual(22.0, mu_prime, places=1)
     self.assertAlmostEqual(8.0, sigma2_prime, places=1)
Ejemplo n.º 6
0
 def test_update(self):
     f = KalmanFilter()
     mu, sigma2, nu, r2 = 10., 8., 13., 2.
     mu_prime, sigma2_prime = f.update(mu=mu, nu=nu, sigma2=sigma2, r2=r2)
     self.assertAlmostEqual(12.4, mu_prime, places=1)
     self.assertAlmostEqual(1.6, sigma2_prime, places=1)