Search in sources :

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

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

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

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

Example 5 with 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);
}
Also used : Parameter(dr.inference.model.Parameter) PowerLawGrowthModel(dr.evomodel.coalescent.PowerLawGrowthModel) 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