Пример #1
0
class TestSkewGaussian(object):
    def setup(self):
        self.skewGassian = SkewGaussian()
        np.random.seed(seed=42)

    def test_pdf(self):
        x = 1
        y = self.skewGassian.pdf(x, e=0., w=1., a=0.)
        assert y == 0.24197072451914337
        x = np.array([0, 1])
        y = self.skewGassian.pdf(x, e=0., w=1., a=0.)
        assert y[0] == 0.3989422804014327
        assert y[1] == 0.24197072451914337

    def test_pdf_skew(self):
        x = 1
        y = self.skewGassian.pdf_skew(x, mu=1, sigma=1, skw=0.5)
        assert y == 0.39834240320473779

        y = self.skewGassian.pdf_skew(x, mu=1, sigma=1, skw=-0.5)
        assert y == 0.39834240320473779
Пример #2
0
 def test_raise(self):
     with self.assertRaises(ValueError):
         skewGassian = SkewGaussian()
         skewGassian.pdf_skew(x=1, mu=1, sigma=1, skw=-1)
     with self.assertRaises(ValueError):
         prob_density.compute_lower_upper_errors(sample=None, num_sigma=4)