コード例 #1
0
ファイル: test.py プロジェクト: fjarri/python-dcmt
	def testSingleRandom(self):
		shape = (9, 10, 11)
		rng = DcmtRandomState(gen_seed=900)
		rng.seed(400)

		r = rng.rand()
		self.assert_(type(r) == float)
コード例 #2
0
    def testSingleRandom(self):
        shape = (9, 10, 11)
        rng = DcmtRandomState(gen_seed=900)
        rng.seed(400)

        r = rng.rand()
        self.assert_(type(r) == float)
コード例 #3
0
ファイル: test.py プロジェクト: fjarri/python-dcmt
	def testRand(self):

		shape = (9, 10, 11)
		rng = DcmtRandomState(gen_seed=900)
		rng.seed(400)

		randoms = rng.rand(*shape)

		self.assert_(randoms.shape == shape)
		diff_mean, diff_var = testLimits(randoms, 0, 1)
		self.assert_(diff_mean < 0.05)
		self.assert_(diff_var < 0.05)
コード例 #4
0
    def testRand(self):

        shape = (9, 10, 11)
        rng = DcmtRandomState(gen_seed=900)
        rng.seed(400)

        randoms = rng.rand(*shape)

        self.assert_(randoms.shape == shape)
        diff_mean, diff_var = testLimits(randoms, 0, 1)
        self.assert_(diff_mean < 0.05)
        self.assert_(diff_var < 0.05)
コード例 #5
0
ファイル: test.py プロジェクト: fjarri/python-dcmt
	def testRandrawFill(self):
		shape = (9, 10, 11)
		rng = DcmtRandomState(gen_seed=900)
		rng.seed(400)

		wrong_val = "aaa"
		wrong_arr = numpy.empty(shape, numpy.int64)
		self.assertRaises(TypeError, rng.rand_fill, wrong_val)
		self.assertRaises(TypeError, rng.rand_fill, wrong_arr)

		for dtype in (numpy.int32, numpy.uint32, numpy.float32):
			randoms = numpy.empty(shape, dtype)
			rng.randraw_fill(randoms)
コード例 #6
0
    def testRandrawFill(self):
        shape = (9, 10, 11)
        rng = DcmtRandomState(gen_seed=900)
        rng.seed(400)

        wrong_val = "aaa"
        wrong_arr = numpy.empty(shape, numpy.int64)
        self.assertRaises(TypeError, rng.rand_fill, wrong_val)
        self.assertRaises(TypeError, rng.rand_fill, wrong_arr)

        for dtype in (numpy.int32, numpy.uint32, numpy.float32):
            randoms = numpy.empty(shape, dtype)
            rng.randraw_fill(randoms)
コード例 #7
0
ファイル: test.py プロジェクト: fjarri/python-dcmt
	def testRandFill(self):
		shape = (9, 10, 11)
		rng = DcmtRandomState(gen_seed=900)
		rng.seed(400)

		wrong_val = "aaa"
		wrong_arr = numpy.empty(shape, numpy.float32)
		self.assertRaises(TypeError, rng.rand_fill, wrong_val)
		self.assertRaises(TypeError, rng.rand_fill, wrong_arr)

		randoms = numpy.empty(shape, numpy.float64)
		rng.rand_fill(randoms)

		diff_mean, diff_var = testLimits(randoms, 0, 1)
		self.assert_(diff_mean < 0.05)
		self.assert_(diff_var < 0.05)
コード例 #8
0
    def testRandFill(self):
        shape = (9, 10, 11)
        rng = DcmtRandomState(gen_seed=900)
        rng.seed(400)

        wrong_val = "aaa"
        wrong_arr = numpy.empty(shape, numpy.float32)
        self.assertRaises(TypeError, rng.rand_fill, wrong_val)
        self.assertRaises(TypeError, rng.rand_fill, wrong_arr)

        randoms = numpy.empty(shape, numpy.float64)
        rng.rand_fill(randoms)

        diff_mean, diff_var = testLimits(randoms, 0, 1)
        self.assert_(diff_mean < 0.05)
        self.assert_(diff_var < 0.05)