Search in sources :

Example 1 with TreeNodeSlide

use of dr.evomodel.operators.TreeNodeSlide in project beast-mcmc by beast-dev.

the class SpeciesTreeModel method scale.

public int scale(double scaleFactor, int nDims, boolean testBounds) {
    assert scaleFactor > 0;
    if (nDims <= 0) {
        // actually when in an up down with operators on the gene trees the flags
        // may indicate a change
        //storeState();  // just checks assert really
        beginTreeEdit();
        final int count = getInternalNodeCount();
        for (int i = 0; i < count; ++i) {
            final NodeRef n = getInternalNode(i);
            setNodeHeight(n, getNodeHeight(n) * scaleFactor);
        }
        endTreeEdit();
        fireModelChanged(this, 1);
        return count;
    } else {
        if (nDims != 1) {
            throw new UnsupportedOperationException("not implemented for count != 1");
        }
        if (internalTreeOP == null) {
            internalTreeOP = new TreeNodeSlide(this, species, 1);
        }
        internalTreeOP.operateOneNode(scaleFactor);
        fireModelChanged(this, 1);
        return nDims;
    }
}
Also used : TreeNodeSlide(dr.evomodel.operators.TreeNodeSlide)

Example 2 with TreeNodeSlide

use of dr.evomodel.operators.TreeNodeSlide in project beast-mcmc by beast-dev.

the class TreeNodeSlideParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    SpeciesBindings species = (SpeciesBindings) xo.getChild(SpeciesBindings.class);
    SpeciesTreeModel tree = (SpeciesTreeModel) xo.getChild(SpeciesTreeModel.class);
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    //final boolean oo = xo.getAttribute("outgroup", false);
    return new TreeNodeSlide(tree, species, /*, oo*/
    weight);
}
Also used : SpeciesBindings(dr.evomodel.speciation.SpeciesBindings) TreeNodeSlide(dr.evomodel.operators.TreeNodeSlide) SpeciesTreeModel(dr.evomodel.speciation.SpeciesTreeModel)

Aggregations

TreeNodeSlide (dr.evomodel.operators.TreeNodeSlide)2 SpeciesBindings (dr.evomodel.speciation.SpeciesBindings)1 SpeciesTreeModel (dr.evomodel.speciation.SpeciesTreeModel)1