def test__sample__size_specified__variance_of_generated_equal_to_specified_variance(
         self):
     gamma_model = utils.build_gamma()
     samples = gamma_model.sample(10000)
     assert_array_almost_equal(np.atleast_2d(np.var(samples, axis=1)),
                               gamma_model.covariance,
                               decimal=2)
 def test__sample__size_specified__mean_of_generated_equal_to_specified_mean(
         self):
     gamma_model = utils.build_gamma()
     samples = gamma_model.sample(1000000)
     assert_array_almost_equal(np.mean(samples, axis=1),
                               gamma_model.mean,
                               decimal=2)
 def test__sample__size_specified__return_horizontally_stacked_random_vectors(
         self):
     gamma_model = utils.build_gamma()
     size = 1000
     samples = gamma_model.sample(size)
     assert samples.shape[0] == 1
     assert samples.shape[1] == size
    def test__from_gamma__cov_mean_dim_must_be_same(self):
        gamma = utils.build_gamma()
        expected_cov_type = CovarianceType.full
        gaussian = convert_to_gaussian(gamma, expected_cov_type)

        assert_equal(gaussian.dim, gamma.dim)
        assert_array_equal(gaussian.covariance, gamma.covariance)
        assert_array_equal(gaussian.mean, gamma.mean)
 def test__sample__size_is_zero__raise_error(self):
     gamma_model = utils.build_gamma()
     with raises(
             Exception,
             match=
             "<size> is negative or equal to zero. Must be integer greater than zero"
     ):
         gamma_model.sample(0)
 def test__sample__size_is_less_than_zero__raise_error(self):
     gamma_model = utils.build_gamma()
     for negative_number in uniform(-100, 0, 100):
         with raises(
                 Exception,
                 match=
                 "<size> is negative or equal to zero. Must be integer greater than zero"
         ):
             gamma_model.sample(negative_number)
 def test__noise_type__always__gamma(self):
     gamma_model = utils.build_gamma()
     assert gamma_model.noise_type is NoiseType.gamma
 def test__dim__always__one(self):
     #  only 1-Dim gamma process is supported at this time
     gamma_model = utils.build_gamma()
     assert gamma_model.dim == 1
 def test__covariance_type__always__full(self):
     gamma_model = utils.build_gamma()
     assert gamma_model.covariance_type is CovarianceType.full