use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ExponentialPopulationSizeModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
Parameter N0Param = null;
if (xo.hasChildNamed(LOG_POPULATION_SIZE)) {
N0Param = (Parameter) xo.getElementFirstChild(LOG_POPULATION_SIZE);
}
Parameter rateParameter = (Parameter) xo.getElementFirstChild(GROWTH_RATE);
// ExponentialPopulationSizeModel provides a model with N0 in log space
return new ExponentialPopulationSizeModel(N0Param, rateParameter, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ConstantPopulationModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(POPULATION_SIZE);
boolean logSpace = cxo.getAttribute(LOG_SPACE, false);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
if (logSpace) {
// ConstantPopulationSizeModel provides a model with N0 in log space
return new ConstantPopulationSizeModel(N0Param, units);
} else {
return new ConstantPopulationModel(N0Param, units);
}
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class EmpiricalPiecewiseModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(INTERVAL_WIDTHS);
double[] intervalWidths = cxo.getDoubleArrayAttribute("values");
cxo = xo.getChild(POPULATION_SIZES);
Parameter popSizes = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(TAU);
Parameter scaleParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(THRESHOLD);
Parameter bParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(LAG);
Parameter offsetParam = (Parameter) cxo.getChild(Parameter.class);
return new EmpiricalPiecewiseModel(intervalWidths, popSizes, scaleParam, bParam, offsetParam, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ExponentialExponentialModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
Parameter N0Param = null;
Parameter N1Param = null;
if (xo.hasChildNamed(POPULATION_SIZE)) {
XMLObject cxo = xo.getChild(POPULATION_SIZE);
N0Param = (Parameter) cxo.getChild(Parameter.class);
} else {
// must be the TRANSITION_POPULATION_SIZE
XMLObject cxo = xo.getChild(TRANSITION_POPULATION_SIZE);
N1Param = (Parameter) cxo.getChild(Parameter.class);
}
XMLObject cxo = xo.getChild(GROWTH_RATE);
Parameter growthParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(ANCESTRAL_GROWTH_RATE);
Parameter ancestralGrowthParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(TRANSITION_TIME);
Parameter timeParam = (Parameter) cxo.getChild(Parameter.class);
return new ExponentialExponentialModel(N0Param, N1Param, growthParam, ancestralGrowthParam, timeParam, units);
}
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);
}
Aggregations