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;
}
Aggregations