Example #1
0
    def test_EstimateDistances_modify_lf(self):
        """tests modifying the lf"""
        def constrain_fit(lf):
            lf.set_param_rule("kappa", is_constant=True)
            lf.optimise(local=True)
            return lf

        d = EstimateDistances(self.al, HKY85(), modify_lf=constrain_fit)
        d.run(show_progress=False)
        result = d.get_pairwise_distances().to_dict()
        d = EstimateDistances(self.al, F81())
        d.run(show_progress=False)
        expect = d.get_pairwise_distances().to_dict()
        self.assertDistsAlmostEqual(expect, result)
 def test_get_param_matrix_coords(self):
     """return correct coords for continuous-time models"""
     f81 = F81()
     self.assertEqual(f81.get_param_matrix_coords(), {})
     self.assertTrue(
         len(f81.get_param_matrix_coords(include_ref_cell=True)["ref_cell"]) == 12
     )
     hky85 = HKY85()
     coords = hky85.get_param_matrix_coords()
     self.assertEqual(set(coords), set(["kappa"]))
     coords = hky85.get_param_matrix_coords(include_ref_cell=True)
     self.assertEqual(set(coords), set(["kappa", "ref_cell"]))
     gn = GN()
     coords = gn.get_param_matrix_coords(include_ref_cell=True)
     self.assertTrue(len(coords) == 12)
     self.assertTrue(len(coords["ref_cell"]) == 1)
Example #3
0
 def test_to_rich_dict(self):
     """returns complete dict of attributes"""
     f81 = F81().to_rich_dict()
     hky85 = HKY85().to_rich_dict()
     gn = GN().to_rich_dict()