use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class BirthDeathCollapseModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
final Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
final double collH = xo.getDoubleAttribute(COLLAPSE_HEIGHT);
XMLObject cxo = xo.getChild(TREE);
final Tree tree = (Tree) cxo.getChild(Tree.class);
final Parameter birthMinusDeath = (Parameter) xo.getElementFirstChild(BIRTHDIFF_RATE);
final Parameter relativeDeathRate = (Parameter) xo.getElementFirstChild(RELATIVE_DEATH_RATE);
final Parameter originHeight = (Parameter) xo.getElementFirstChild(ORIGIN_HEIGHT);
final Parameter collapseWeight = (Parameter) xo.getElementFirstChild(COLLAPSE_WEIGHT);
final String modelName = xo.getId();
return new BirthDeathCollapseModel(modelName, tree, units, birthMinusDeath, relativeDeathRate, originHeight, collapseWeight, collH);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class SIRepidemicModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = (XMLObject) xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
boolean usingGrowthRate = true;
Parameter rParam = null;
if (xo.getChild(GROWTH_RATE) != null) {
cxo = (XMLObject) xo.getChild(GROWTH_RATE);
rParam = (Parameter) cxo.getChild(Parameter.class);
} else {
cxo = (XMLObject) xo.getChild(DOUBLING_TIME);
rParam = (Parameter) cxo.getChild(Parameter.class);
usingGrowthRate = false;
}
cxo = (XMLObject) xo.getChild(TPEAK);
Parameter tpeakParam = (Parameter) cxo.getChild(Parameter.class);
cxo = (XMLObject) xo.getChild(GAMMA);
Parameter gammaParam = (Parameter) cxo.getChild(Parameter.class);
double minPrevalence = xo.getDoubleAttribute(MIN_PREVALENCE);
return new SIRepidemicModel(N0Param, rParam, tpeakParam, gammaParam, units, usingGrowthRate, minPrevalence);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class LogisticGrowthN0ModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = (XMLObject) xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
boolean usingGrowthRate = true;
Parameter rParam = null;
if (xo.getChild(GROWTH_RATE) != null) {
cxo = (XMLObject) xo.getChild(GROWTH_RATE);
rParam = (Parameter) cxo.getChild(Parameter.class);
} else {
cxo = (XMLObject) xo.getChild(DOUBLING_TIME);
rParam = (Parameter) cxo.getChild(Parameter.class);
usingGrowthRate = false;
}
cxo = (XMLObject) xo.getChild(TIME_50);
Parameter t50Param = (Parameter) cxo.getChild(Parameter.class);
return new LogisticGrowthN0Model(N0Param, rParam, t50Param, units, usingGrowthRate);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class LinearGrowthModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(SLOPE);
Parameter slopeParam = (Parameter) cxo.getChild(Parameter.class);
return new LinearGrowthModel(slopeParam, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ScaledPiecewiseModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(EPOCH_SIZES);
Parameter epochSizes = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(TREE_MODEL);
TreeModel treeModel = (TreeModel) cxo.getChild(TreeModel.class);
boolean isLinear = xo.getBooleanAttribute("linear");
return new ScaledPiecewiseModel(epochSizes, treeModel, isLinear, units);
}
Aggregations