Esempio n. 1
0
 def test_lnlikelihood(self):
     t = np.arange(0, 1, 0.01)
     S = np.random.random(t.size)
     theta = self.random_theta(3, 2)
     kursl = KurSL(theta)
     model = ModelWrapper(kursl)
     lnlikelihood = KurslMCMC.lnlikelihood(theta, t, S[:-1], model)
     self.assertTrue(lnlikelihood < 0, "Any negative value is good")
Esempio n. 2
0
 def test_lnlikelihood_zero(self):
     t = np.arange(0, 1, 0.01)
     S = 2 * np.cos(10 * t + 0) + 6 * np.cos(20 * t + 4)
     theta = np.array([
         [10, 0, 2, 0],
         [20, 4, 6, 0],
     ])
     kursl = KurSL(theta)
     model = ModelWrapper(kursl)
     lnlikelihood = KurslMCMC.lnlikelihood(theta, t, S[:-1], model)
     self.assertEqual(np.round(lnlikelihood, 10), 0,
                      "Exact reconstruction should return 0")
     self.assertTrue(model.THRESHOLD_OBTAINED, "0 is below any threshold")