Search in sources :

Example 11 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.EmpiricalPiecewiseModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 12 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class ExponentialConstantModelParser 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 logGrowthParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(TRANSITION_TIME);
    Parameter timeParam = (Parameter) cxo.getChild(Parameter.class);
    return new ExponentialConstantModel(N0Param, logGrowthParam, timeParam, units);
}
Also used : Parameter(dr.inference.model.Parameter) ExponentialConstantModel(dr.evomodel.coalescent.ExponentialConstantModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 13 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);
    XMLObject cxo = xo.getChild(POPULATION_SIZE);
    Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
    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, growthParam, ancestralGrowthParam, timeParam, units);
}
Also used : Parameter(dr.inference.model.Parameter) ExponentialExponentialModel(dr.evomodel.coalescent.ExponentialExponentialModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 14 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class LinearGrowthModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = xo.getChild(SLOPE);
    Parameter slopeParam = (Parameter) cxo.getChild(Parameter.class);
    return new LinearGrowthModel(slopeParam, units);
}
Also used : Parameter(dr.inference.model.Parameter) LinearGrowthModel(dr.evomodel.coalescent.LinearGrowthModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 15 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class SamplesPanel method timeScaleChanged.

public final void timeScaleChanged() {
    Units.Type units = Units.Type.YEARS;
    switch(unitsCombo.getSelectedIndex()) {
        case 0:
            units = Units.Type.YEARS;
            break;
        case 1:
            units = Units.Type.MONTHS;
            break;
        case 2:
            units = Units.Type.DAYS;
            break;
    }
    boolean backwards = directionCombo.getSelectedIndex() == 1;
    for (int i = 0; i < taxonList.getTaxonCount(); i++) {
        Date date = taxonList.getTaxon(i).getDate();
        double d = date.getTimeValue();
        Date newDate = createDate(d, units, backwards, 0.0);
        newDate.setUncertainty(date.getUncertainty());
        taxonList.getTaxon(i).setDate(newDate);
    }
    calculateHeights();
    dataTableModel.fireTableDataChanged();
    frame.timeScaleChanged();
}
Also used : Units(dr.evolution.util.Units) Date(dr.evolution.util.Date)

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