use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ExponentialGrowthModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
Parameter rParam;
boolean usingGrowthRate = true;
if (xo.getChild(GROWTH_RATE) != null) {
cxo = xo.getChild(GROWTH_RATE);
rParam = (Parameter) cxo.getChild(Parameter.class);
} else {
cxo = xo.getChild(DOUBLING_TIME);
rParam = (Parameter) cxo.getChild(Parameter.class);
usingGrowthRate = false;
}
return new ExponentialGrowthModel(N0Param, rParam, units, usingGrowthRate);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ExponentialLogisticModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(LOGISTIC_GROWTH_RATE);
Parameter logGrowthParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(LOGISTIC_SHAPE);
Parameter shapeParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(EXPONENTIAL_GROWTH_RATE);
Parameter expGrowthParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(TRANSITION_TIME);
Parameter timeParam = (Parameter) cxo.getChild(Parameter.class);
double alpha = xo.getDoubleAttribute(ALPHA);
return new ExponentialLogisticModel(N0Param, logGrowthParam, shapeParam, expGrowthParam, timeParam, alpha, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class CataclysmicDemographicModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(GROWTH_RATE);
Parameter rParam = (Parameter) cxo.getChild(Parameter.class);
Parameter secondParam = null;
boolean useSpike = true;
if (xo.hasChildNamed(SPIKE_SIZE)) {
cxo = xo.getChild(SPIKE_SIZE);
secondParam = (Parameter) cxo.getChild(Parameter.class);
} else if (xo.hasChildNamed(DECLINE_RATE)) {
cxo = xo.getChild(DECLINE_RATE);
secondParam = (Parameter) cxo.getChild(Parameter.class);
useSpike = false;
} else {
throw new XMLParseException("Must provide either a spike factor or decline rate");
}
cxo = xo.getChild(TIME_OF_CATACLYSM);
Parameter tParam = (Parameter) cxo.getChild(Parameter.class);
return new CataclysmicDemographicModel(N0Param, secondParam, rParam, tParam, units, useSpike);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ConstantLogisticModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(ANCESTRAL_POPULATION_SIZE);
Parameter N1Param = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(GROWTH_RATE);
Parameter rParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(SHAPE);
Parameter cParam = (Parameter) cxo.getChild(Parameter.class);
double alpha = xo.getDoubleAttribute(ALPHA);
return new ConstantLogisticModel(N0Param, N1Param, rParam, cParam, alpha, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class EmergingEpidemicModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
Parameter growthRateParameter = (Parameter) xo.getElementFirstChild(GROWTH_RATE);
Parameter generationTimeParameter = (Parameter) xo.getElementFirstChild(GENERATION_TIME);
Parameter generationShapeParameter = (Parameter) xo.getElementFirstChild(GENERATION_DISTRIBUTION_SHAPE);
Parameter offspringDispersionParameter = (Parameter) xo.getElementFirstChild(OFFSPRING_DISPERSION);
TreeModel tree = (TreeModel) xo.getElementFirstChild(TREE);
return new EmergingEpidemicModel(growthRateParameter, generationTimeParameter, generationShapeParameter, offspringDispersionParameter, tree, units);
}
Aggregations