use of dr.evomodel.coalescent.PiecewisePopulationModel in project beast-mcmc by beast-dev.
the class PiecewisePopulationModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject obj = xo.getChild(EPOCH_WIDTHS);
double[] epochWidths = obj.getDoubleArrayAttribute(WIDTHS);
if (xo.hasChildNamed(EPOCH_SIZES)) {
Parameter epochSizes = (Parameter) xo.getElementFirstChild(EPOCH_SIZES);
boolean isLinear = false;
if (xo.hasAttribute(LINEAR)) {
isLinear = xo.getBooleanAttribute(LINEAR);
}
return new PiecewisePopulationModel(PIECEWISE_POPULATION, epochSizes, epochWidths, isLinear, units);
} else {
Parameter populationSize = (Parameter) xo.getElementFirstChild(POPULATION_SIZE);
Parameter growthRates = (Parameter) xo.getElementFirstChild(GROWTH_RATES);
return new PiecewisePopulationModel(PIECEWISE_POPULATION, populationSize, growthRates, epochWidths, units);
}
}
Aggregations