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