def test_ekf0_initialdistribution(self): filtsmooth_object = ivp2filter.ivp2ekf0(self.ivp, self.prior, self.evlvar) expected_initval = np.array([ self.ivp.initrv.mean, self.ivp(self.ivp.t0, self.ivp.initrv.mean), self.ivp.jacobian(self.ivp.t0, self.ivp.initrv.mean) @ self.ivp( self.ivp.t0, self.ivp.initrv.mean), ]) self.assertAllClose(filtsmooth_object.initialrandomvariable.mean, expected_initval.T.flatten())
def test_ekf0_measmod(self): filtsmooth_object = ivp2filter.ivp2ekf0(self.ivp, self.prior, self.evlvar) random_time, random_eval = np.random.rand(), np.random.rand( self.prior.ndim) e0, e1 = self.prior.proj2coord(0), self.prior.proj2coord(1) expected_measmodel_output = e1 @ random_eval - self.ivp.rhs( random_time, e0 @ random_eval) measmodel_output = filtsmooth_object.measurementmodel.dynamics( random_time, random_eval) self.assertAllClose(expected_measmodel_output, measmodel_output)
def test_ivp2ekf0_output(self): filtsmooth_object = ivp2filter.ivp2ekf0(self.ivp, self.prior, self.evlvar) self.assertEqual(issubclass(type(filtsmooth_object), ExtendedKalman), True)