Ejemplo n.º 1
0
 def testEvaluateDKappa(self):
     "Test vonMisesSufficient.evaluate_derivative_kappa degenerate case"
     for i in xrange(100):
         randno = [uniform(-4 * pi, 4 * pi), uniform(-pi, pi), uniform(0.1, 100)]
         fn = vonMises(*randno)
         fn2 = vonMisesSufficient(randno[0], 1, 1, randno[1], randno[2])
         self.assertAlmostEqual(fn.evaluate_derivative_kappa(), fn2.evaluate_derivative_kappa(), delta=0.001)
Ejemplo n.º 2
0
 def testDensity(self):
     "Test vonMisesSufficient.density degenerate case"
     for i in xrange(100):
         randno = [uniform(-4 * pi, 4 * pi), uniform(-pi, pi), uniform(0.1, 100)]
         fn = vonMises(*randno)
         fn2 = vonMisesSufficient(randno[0], 1, 1, randno[1], randno[2])
         self.assertAlmostEqual(fn.density(), fn2.density(), delta=0.001)
 def testEvaluate(self):
     "tests vonMisesSufficient.evaluate"
     for i in xrange(100):
         randno = [uniform(-4 * pi, 4 * pi), uniform(-pi, pi), uniform(0.1, 100)]
         fn = vonMises(*randno)
         fn2 = vonMisesSufficient(randno[0], 1, 1, randno[1], randno[2])
         self.assertAlmostEqual(fn.evaluate(), fn2.evaluate(), delta=0.001)
Ejemplo n.º 4
0
 def testEvaluateDMu(self):
     "tests vonMises.evaluate_derivative_mu"
     for i in xrange(100):
         randno = [uniform(-4*pi,4*pi), uniform(-pi,pi),
                 uniform(0.1,100)]
         fn=vonMises(*randno)
         self.assertAlmostEqual(fn.evaluate_derivative_mu(),
                 -randno[2]*sin(randno[0]-randno[1]),
                 delta=0.001)
Ejemplo n.º 5
0
 def testDensity(self):
     "Test vonMisesSufficient.density degenerate case"
     for i in xrange(100):
         randno = [
             uniform(-4 * pi, 4 * pi),
             uniform(-pi, pi),
             uniform(0.1, 100)
         ]
         fn = vonMises(*randno)
         fn2 = vonMisesSufficient(randno[0], 1, 1, randno[1], randno[2])
         self.assertAlmostEqual(fn.density(), fn2.density(), delta=0.001)
Ejemplo n.º 6
0
 def testEvaluateDMu(self):
     "tests vonMises.evaluate_derivative_mu"
     for i in xrange(100):
         randno = [
             uniform(-4 * pi, 4 * pi),
             uniform(-pi, pi),
             uniform(0.1, 100)
         ]
         fn = vonMises(*randno)
         self.assertAlmostEqual(fn.evaluate_derivative_mu(),
                                -randno[2] * sin(randno[0] - randno[1]),
                                delta=0.001)
Ejemplo n.º 7
0
 def testEvaluateDKappa(self):
     "Test vonMisesSufficient.evaluate_derivative_kappa degenerate case"
     for i in xrange(100):
         randno = [
             uniform(-4 * pi, 4 * pi),
             uniform(-pi, pi),
             uniform(0.1, 100)
         ]
         fn = vonMises(*randno)
         fn2 = vonMisesSufficient(randno[0], 1, 1, randno[1], randno[2])
         self.assertAlmostEqual(fn.evaluate_derivative_kappa(),
                                fn2.evaluate_derivative_kappa(),
                                delta=0.001)
Ejemplo n.º 8
0
 def testDensity(self):
     "tests vonMises.density"
     try:
         from scipy.special import i0,i1
     except ImportError:
         self.skipTest("this test requires the scipy Python module")
     for i in xrange(100):
         randno = [uniform(-4*pi,4*pi), uniform(-pi,pi),
                 uniform(0.1,100)]
         fn=vonMises(*randno)
         self.assertAlmostEqual(fn.density(),
                 exp(randno[2]*cos(randno[0]-randno[1]))/(2*pi*i0(randno[2])),
                 delta=0.001)
Ejemplo n.º 9
0
 def testEvaluateDKappa(self):
     "tests vonMises.evaluate_derivative_kappa"
     try:
         from scipy.special import i0,i1
     except ImportError:
         self.skipTest("this test requires the scipy Python module")
     for i in xrange(100):
         randno = [uniform(-4*pi,4*pi), uniform(-pi,pi),
                 uniform(0.1,100)]
         fn=vonMises(*randno)
         self.assertAlmostEqual(fn.evaluate_derivative_kappa(),
                 i1(randno[2])/i0(randno[2]) - cos(randno[0]-randno[1]),
                 delta=0.001)
Ejemplo n.º 10
0
 def testEvaluateDKappa(self):
     "tests vonMises.evaluate_derivative_kappa"
     try:
         from scipy.special import i0, i1
     except ImportError:
         self.skipTest("this test requires the scipy Python module")
     for i in xrange(100):
         randno = [
             uniform(-4 * pi, 4 * pi),
             uniform(-pi, pi),
             uniform(0.1, 100)
         ]
         fn = vonMises(*randno)
         self.assertAlmostEqual(fn.evaluate_derivative_kappa(),
                                i1(randno[2]) / i0(randno[2]) -
                                cos(randno[0] - randno[1]),
                                delta=0.001)
Ejemplo n.º 11
0
 def testEvaluate(self):
     "tests vonMises.evaluate"
     try:
         from scipy.special import i0, i1
     except ImportError:
         self.skipTest("this test requires the scipy Python module")
     for i in range(100):
         randno = [
             uniform(-4 * pi, 4 * pi),
             uniform(-pi, pi),
             uniform(0.1, 100)
         ]
         fn = vonMises(*randno)
         self.assertAlmostEqual(fn.evaluate(),
                                log(2 * pi * i0(randno[2])) -
                                randno[2] * cos(randno[0] - randno[1]),
                                delta=0.001)