treetime/treetime.py
def add_coalescent_model(self, Tc, **kwargs):
        """Add a coalescent model to the tree and optionally optimze

        Parameters
        ----------
        Tc : float,str
            If this is a float, it will be interpreted as the inverse merger
            rate in molecular clock units, if its is a
        """
        from .merger_models import Coalescent
        self.logger('TreeTime.run: adding coalescent prior with Tc='+str(Tc),1)
        self.merger_model = Coalescent(self.tree,
                                       date2dist=self.date2dist, logger=self.logger)

        if Tc=='skyline': # restrict skyline model optimization to last iteration
            self.merger_model.optimize_skyline(**kwargs)
            self.logger("optimized a skyline ", 2)
        else:
            if Tc in ['opt', 'const']:
                self.merger_model.optimize_Tc()
                self.logger("optimized Tc to %f"%self.merger_model.Tc.y[0], 2)
            else:
                try:
                    self.merger_model.set_Tc(Tc)
                except:
                    self.logger("setting of coalescent time scale failed", 1, warn=True)

        self.merger_model.attach_to_tree()
def add_coalescent_model(self, Tc, **kwargs):
        from .merger_models import Coalescent
        self.logger('TreeTime.run: adding coalescent prior with Tc='+str(Tc),1)
        self.merger_model = Coalescent(self.tree,
                                       date2dist=self.date2dist, logger=self.logger)

        if Tc=='skyline': # restrict skyline model optimization to last iteration
            self.merger_model.optimize_skyline(**kwargs)
            self.logger("optimized a skyline ", 2)
        else:
            if Tc in ['opt', 'const']:
                self.merger_model.optimize_Tc()
                self.logger("optimized Tc to %f"%self.merger_model.Tc.y[0], 2)
            else:
                try:
                    self.merger_model.set_Tc(Tc)
                except:
                    self.logger("setting of coalescent time scale failed", 1, warn=True)

        self.merger_model.attach_to_tree()
def add_coalescent_model ( self , Tc , * * kwargs ) : from . merger_models import Coalescent self . logger ( 'TreeTime.run: adding coalescent prior with Tc=' + str ( Tc ) , 1 ) self . merger_model = Coalescent ( self . tree , date2dist = self . date2dist , logger = self . logger ) if Tc == 'skyline' : # restrict skyline model optimization to last iteration self . merger_model . optimize_skyline ( * * kwargs ) self . logger ( "optimized a skyline " , 2 ) else : if Tc in [ 'opt' , 'const' ] : self . merger_model . optimize_Tc ( ) self . logger ( "optimized Tc to %f" % self . merger_model . Tc . y [ 0 ] , 2 ) else : try : self . merger_model . set_Tc ( Tc ) except : self . logger ( "setting of coalescent time scale failed" , 1 , warn = True ) self . merger_model . attach_to_tree ( )
Add a coalescent model to the tree and optionally optimze

        Parameters
        ----------
        Tc : float,str
            If this is a float, it will be interpreted as the inverse merger
            rate in molecular clock units, if its is a
Add a coalescent model to the tree and optionally optimze