@@ -81,6 +81,8 @@ def test_generateRealizationWithKF(self):
8181 plt.legend()
8282 """
8383 mse .append (np .mean ((Y - Yp ) ** 2 ))
84+
85+ # Verify stochastic and predictor realizations match
8486 np .testing .assert_almost_equal (Y , Yp , decimal = 10 )
8587 # np.testing.assert_equal(Y, Yp)
8688 # np.testing.assert_allclose(Y, Yp, rtol=1e-3)
@@ -105,6 +107,8 @@ def test_solveric(self):
105107 out = (np .array ([[0.6479 , 0.0861 ], [0.6025 , - 0.1736 ]]), True )
106108
107109 P , has_solution = solveric (** inp )
110+
111+ # Verify solveric result against known solution
108112 np .testing .assert_equal (out [1 ], has_solution )
109113 np .testing .assert_allclose (out [0 ], P , rtol = 1e-3 )
110114
@@ -128,6 +132,7 @@ def test_solve_discrete_are_iterative(self):
128132 s .A .T , s .C .T , s .Q , s .R , s = s .S , return_log = True
129133 )
130134
135+ # Verify iterative solver matches scipy implementation
131136 np .testing .assert_almost_equal (Pp1 , Pp2 )
132137 np .testing .assert_almost_equal (0 , PpNormChanges [- 1 ])
133138
@@ -153,6 +158,7 @@ def test_LSSM_randomize_in_predictor_form(self):
153158 etcBlock = np .copy (s .A_KC )
154159 etcBlock [:n1 , n1 :] = 0
155160 try :
161+ # Verify predictor form structure
156162 np .testing .assert_almost_equal (trBlock , np .zeros_like (trBlock ))
157163 np .testing .assert_allclose (
158164 (s .A_KC - etcBlock ) / np .linalg .norm (etcBlock ),
@@ -313,6 +319,7 @@ def test_kalmanFilterAndSmoothingForS0Nu0(self):
313319 filtered_state_means_2 , filtered_state_covariances_2 = kf .filter (Y )
314320 smoothed_state_means_2 , smoothed_state_covariances_2 = kf .smooth (Y )
315321
322+ # Verify against pykalman
316323 np .testing .assert_allclose (
317324 filtered_state_means , filtered_state_means_2 , rtol = 1e-3
318325 )
@@ -511,6 +518,7 @@ def test_forwardBackwardSmootherBeingTheSameAsRTS(self):
511518 # """
512519
513520 try :
521+ # Verify Forward-Backward smoother matches RTS
514522 np .testing .assert_allclose (allXp , allXpFB , rtol = 1e-4 )
515523 np .testing .assert_allclose (allXs , allXsFB , rtol = 1e-4 )
516524 np .testing .assert_allclose (allPs , allPsFB , rtol = 1e-4 )
0 commit comments