Search in sources :

Example 1 with SmoothSkygridLikelihood

use of dr.evomodel.coalescent.smooth.SmoothSkygridLikelihood in project beast-mcmc by beast-dev.

the class SmoothSkygridLikelihoodParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    List<IntervalList> intervalList = new ArrayList<>();
    List<TreeIntervals> debugIntervalList = new ArrayList<>();
    if (xo.hasChildNamed(INTERVALS)) {
        XMLObject cxo = xo.getChild(INTERVALS);
        for (int i = 0; i < cxo.getChildCount(); ++i) {
            intervalList.add((IntervalList) cxo.getChild(i));
        }
    } else {
        XMLObject cxo = xo.getChild(POPULATION_TREE);
        for (int i = 0; i < cxo.getChildCount(); ++i) {
            TreeModel tree = (TreeModel) cxo.getChild(i);
            intervalList.add(new BigFastTreeIntervals(tree));
            debugIntervalList.add(new TreeIntervals(tree));
        }
    }
    Parameter logPopSizes = (Parameter) xo.getElementFirstChild(POPULATION_PARAMETER);
    Parameter gridPoints = (Parameter) xo.getElementFirstChild(GRID_POINTS);
    if (!SmoothSkygridLikelihood.checkValidParameters(logPopSizes, gridPoints)) {
        throw new XMLParseException("Invalid initial parameters");
    }
    SmoothSkygridLikelihood likelihood = new SmoothSkygridLikelihood(xo.getId(), intervalList, logPopSizes, gridPoints);
    likelihood.setDebugIntervalList(debugIntervalList);
    return likelihood;
}
Also used : SmoothSkygridLikelihood(dr.evomodel.coalescent.smooth.SmoothSkygridLikelihood) TreeModel(dr.evomodel.tree.TreeModel) BigFastTreeIntervals(dr.evomodel.bigfasttree.BigFastTreeIntervals) IntervalList(dr.evolution.coalescent.IntervalList) ArrayList(java.util.ArrayList) Parameter(dr.inference.model.Parameter) TreeIntervals(dr.evolution.coalescent.TreeIntervals) BigFastTreeIntervals(dr.evomodel.bigfasttree.BigFastTreeIntervals)

Aggregations

IntervalList (dr.evolution.coalescent.IntervalList)1 TreeIntervals (dr.evolution.coalescent.TreeIntervals)1 BigFastTreeIntervals (dr.evomodel.bigfasttree.BigFastTreeIntervals)1 SmoothSkygridLikelihood (dr.evomodel.coalescent.smooth.SmoothSkygridLikelihood)1 TreeModel (dr.evomodel.tree.TreeModel)1 Parameter (dr.inference.model.Parameter)1 ArrayList (java.util.ArrayList)1