Ejemplo n.º 1
0
    def test_median(self):
        rhtype = RateHetType.GAMMA_EQ_CAT_MEDIAN
        rhm = RateHetManager(shape=0.5, n_cat=4, distrib_code=rhtype)
        expected = [0.02907775, 0.28071453, 0.92477307, 2.76543465]
        assert_list_eq(self, rhm.rates, expected)

        rhm.set_shape(4.2)
        expected = [0.49655820, 0.79929783, 1.10263121, 1.60151276]
        assert_list_eq(self, rhm.rates, expected)
Ejemplo n.º 2
0
    def test_mean(self):
        rhtype = RateHetType.GAMMA_EQ_CAT_MEAN
        rhm = RateHetManager(shape=0.5, n_cat=4, distrib_code=rhtype)
        expected = [0.03338775, 0.25191592, 0.82026848, 2.89442785]
        assert_list_eq(self, rhm.rates, expected)
        self.assertEqual(rhm.n_cat, 4)
        self.assertTrue(abs(rhm.shape-0.5) < 1.0e-5)

        rhm.set_shape(4.2)
        expected = [0.46502269, 0.78185321, 1.08432009, 1.66880400]
        assert_list_eq(self, rhm.rates, expected)
        self.assertEqual(rhm.n_cat, 4)
        self.assertTrue(abs(rhm.shape-4.2) < 1.0e-5)

        rhm = RateHetManager(shape=0.53, n_cat=10, distrib_code=rhtype)
        expected = [0.00680095, 0.04407109, 0.11615143, 0.22625412, 0.38203227,
                    0.59769745, 0.90010946, 1.34639481, 2.09367223, 4.28681618]
        assert_list_eq(self, rhm.rates, expected)
        self.assertEqual(rhm.n_cat, 10)
        self.assertTrue(abs(rhm.shape-0.53) < 1.0e-5)