Ejemplo n.º 1
0
 def test_logseries_convergence(self):
     # Test for ticket #923
     N = 1000
     rnd.seed(0)
     rvsn = rnd.logseries(0.8, size=N)
     # these two frequency counts should be close to theoretical
     # numbers with this large sample
     # theoretical large N result is 0.49706795
     freq = np.sum(rvsn == 1) / float(N)
     msg = "Frequency was %f, should be > 0.45" % freq
     assert_(freq > 0.45, msg)
     # theoretical large N result is 0.19882718
     freq = np.sum(rvsn == 2) / float(N)
     msg = "Frequency was %f, should be < 0.23" % freq
     assert_(freq < 0.23, msg)
Ejemplo n.º 2
0
 def test_logseries(self):
     rnd.seed(self.seed, self.brng)
     actual = rnd.logseries(p=.923456789, size=(3, 2))
     desired = np.array([[18, 1], [1, 1], [5, 19]])
     np.testing.assert_array_equal(actual, desired)