Search in sources :

Example 21 with Units

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);
}
Also used : Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits) ExponentialPopulationSizeModel(dr.evomodel.coalescent.ExponentialPopulationSizeModel)

Example 22 with 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);
    }
}
Also used : ConstantPopulationModel(dr.evomodel.coalescent.demographicmodel.ConstantPopulationModel) ConstantPopulationSizeModel(dr.evomodel.coalescent.ConstantPopulationSizeModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 23 with 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);
}
Also used : Parameter(dr.inference.model.Parameter) EmpiricalPiecewiseModel(dr.evomodel.coalescent.demographicmodel.EmpiricalPiecewiseModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 24 with 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);
}
Also used : Parameter(dr.inference.model.Parameter) ExponentialExponentialModel(dr.evomodel.coalescent.demographicmodel.ExponentialExponentialModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 25 with 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);
}
Also used : ExponentialLogisticModel(dr.evomodel.coalescent.demographicmodel.ExponentialLogisticModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Aggregations

Units (dr.evolution.util.Units)70 XMLUnits (dr.evoxml.util.XMLUnits)65 Parameter (dr.inference.model.Parameter)62 TreeModel (dr.evomodel.tree.TreeModel)4 Date (dr.evolution.util.Date)3 MultiEpochExponential (dr.evolution.coalescent.MultiEpochExponential)2 ConstantPopulationSizeModel (dr.evomodel.coalescent.ConstantPopulationSizeModel)2 ExponentialPopulationSizeModel (dr.evomodel.coalescent.ExponentialPopulationSizeModel)2 BirthDeathGernhard08Model (dr.evomodel.speciation.BirthDeathGernhard08Model)2 BirthDeathSerialSamplingModel (dr.evomodel.speciation.BirthDeathSerialSamplingModel)2 TreePriorParameterizationType (dr.app.beauti.types.TreePriorParameterizationType)1 TreePriorType (dr.app.beauti.types.TreePriorType)1 ExponentialExponential (dr.evolution.coalescent.ExponentialExponential)1 ExponentialGrowth (dr.evolution.coalescent.ExponentialGrowth)1 Importer (dr.evolution.io.Importer)1 NewickImporter (dr.evolution.io.NewickImporter)1 SimpleNode (dr.evolution.tree.SimpleNode)1 SimpleTree (dr.evolution.tree.SimpleTree)1 Tree (dr.evolution.tree.Tree)1 Taxon (dr.evolution.util.Taxon)1