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);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class TwoEpochDemographicModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(EPOCH_1);
DemographicModel demo1 = (DemographicModel) cxo.getChild(DemographicModel.class);
cxo = xo.getChild(EPOCH_2);
DemographicModel demo2 = (DemographicModel) cxo.getChild(DemographicModel.class);
cxo = xo.getChild(TRANSITION_TIME);
Parameter timeParameter = (Parameter) cxo.getChild(Parameter.class);
return new TwoEpochDemographicModel(demo1, demo2, timeParameter, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class PeakAndDeclineModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(PEAK_VALUE);
Parameter peakValueParam = (Parameter) cxo.getChild(Parameter.class);
Parameter rParam;
cxo = xo.getChild(SHAPE);
rParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(PEAK_TIME);
Parameter peakTimeParam = (Parameter) cxo.getChild(Parameter.class);
return new PeakAndDeclineModel(peakValueParam, rParam, peakTimeParam, units);
}
use of dr.evolution.util.Units 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);
}
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class PowerLawGrowthModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(N0);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
Parameter rParam;
cxo = xo.getChild(POWER);
rParam = (Parameter) cxo.getChild(Parameter.class);
return new PowerLawGrowthModel(N0Param, rParam, units);
}
Aggregations