class Test_RayleighCDF(unittest.TestCase): def setUp(self): self.cdf = RayleighCDF() self.cdf.x = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0] self.cdf.xbar = 8.35 def test_functionality(self): self.cdf.run() F = np.array([0.01120142, 0.04405846, 0.09641191, 0.16492529, 0.24543643, 0.33337438, 0.42418386, 0.51370329, 0.59845474, 0.67582215, 0.74411323, 0.80251778, 0.85098711, 0.89006516, 0.92070195, 0.94407508, 0.96143762, 0.97400212, 0.98286327, 0.98895582, 0.99304088, 0.99571263, 0.99741748, 0.99847906, 0.99912422, 0.99950695]) self.assertEqual(self.cdf.F.all(), F.all()) def test_gradient(self): check_gradient_unit_test(self, self.cdf, display=False)
def setUp(self): self.cdf = RayleighCDF() self.cdf.x = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0] self.cdf.xbar = 8.35