Exemplo n.º 1
0
 def testdmu(self):
     "Test LognormalRestraint(3) mu derivative"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         gr.evaluate(True)
         self.assertAlmostEqual(Nuisance(self.mu).get_nuisance_derivative(),
                                self.deriv_mu(*self.all))
Exemplo n.º 2
0
 def testdsigma(self):
     "Test LognormalRestraint(3) sigma derivative"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         gr.evaluate(True)
         self.assertAlmostEqual(
             Nuisance(self.sigma).get_nuisance_derivative(),
             self.deriv_sigma(*self.all))
Exemplo n.º 3
0
 def testE(self):
     "Test LognormalRestraint(3) score"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         e = gr.evaluate(False)
         self.assertAlmostEqual(e, self.normal_e(*self.all))
Exemplo n.º 4
0
 def testSanityPE(self):
     "Test if LognormalRestraint(13) prob is exp(-score)"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         self.assertAlmostEqual(gr.get_probability(),
                                exp(-gr.evaluate(False)), delta=0.001)
Exemplo n.º 5
0
 def testE(self):
     "Test LognormalRestraint(3) score"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         e = gr.evaluate(False)
         self.assertAlmostEqual(e, self.normal_e(*self.all))
Exemplo n.º 6
0
 def testSanityPE(self):
     "Test if LognormalRestraint(13) prob is exp(-score)"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         self.assertAlmostEqual(gr.get_probability(),
                                exp(-gr.evaluate(False)),
                                delta=0.001)
Exemplo n.º 7
0
 def testSanityEP(self):
     "Test if LognormalRestraint(13) score is -log(prob)"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         expected = gr.get_probability()
         if expected == 0:
             continue
         self.assertAlmostEqual(-log(expected),
                                gr.evaluate(False), delta=0.001)
Exemplo n.º 8
0
 def testSanityEP(self):
     "Test if LognormalRestraint(13) score is -log(prob)"
     gr = LognormalRestraint(*self.all)
     for i in range(100):
         map(self.change_value, self.all)
         expected = gr.get_probability()
         if expected == 0:
             continue
         self.assertAlmostEqual(-log(expected),
                                gr.evaluate(False),
                                delta=0.001)