Search in sources :

Example 6 with TreeTrace

use of dr.evolution.io.TreeTrace in project beast-mcmc by beast-dev.

the class WeightedMultiplicativeBinary method getTree.

/**
     * get the i'th tree of the trace
     *
     * @param index
     * @return the i'th tree of the trace
     */
public final Tree getTree(int index) {
    int oldTreeCount = 0;
    int newTreeCount = 0;
    for (TreeTrace trace : traces) {
        newTreeCount += trace.getTreeCount(burnin * trace.getStepSize());
        if (index < newTreeCount) {
            return trace.getTree(index - oldTreeCount, burnin * trace.getStepSize());
        }
        oldTreeCount = newTreeCount;
    }
    throw new RuntimeException("Couldn't find tree " + index);
}
Also used : TreeTrace(dr.evolution.io.TreeTrace)

Aggregations

TreeTrace (dr.evolution.io.TreeTrace)6 SimpleTree (dr.evolution.tree.SimpleTree)2 Tree (dr.evolution.tree.Tree)2