示例#1
0
class Test_WeibullCDF(unittest.TestCase):

    def setUp(self):

        self.cdf = WeibullCDF()

        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.A = 8.35
        self.cdf.k = 2.15

    def test_functionality(self):
        
        self.cdf.run()
        
        F = np.array([0.01037793,  0.04524528,  0.10480121,  0.18575653,  0.28252447,  0.38820584,
              0.49562699,  0.59829918,  0.69114560,  0.77089646,  0.83613421,  0.88704769,
              0.92500346,  0.95205646,  0.97050303,  0.98254137,  0.99006279,  0.99456267,
              0.99714093,  0.99855575,  0.99929934,  0.99967365,  0.9998541,   0.99993741,
              0.99997424,  0.99998983])
        
        self.assertEqual(self.cdf.F.all(), F.all())

    def test_gradient(self):

        check_gradient_unit_test(self, self.cdf, display=False)
示例#2
0
    def setUp(self):

        self.cdf = WeibullCDF()

        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.A = 8.35
        self.cdf.k = 2.15