Search in sources :

Example 66 with Units

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

the class ExpansionModelParser 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(ANCESTRAL_POPULATION_PROPORTION);
    Parameter N1Param = (Parameter) cxo.getChild(Parameter.class);
    Parameter rParam;
    boolean usingGrowthRate = true;
    if (xo.getChild(GROWTH_RATE) != null) {
        cxo = xo.getChild(GROWTH_RATE);
        rParam = (Parameter) cxo.getChild(Parameter.class);
    } else {
        cxo = xo.getChild(DOUBLING_TIME);
        rParam = (Parameter) cxo.getChild(Parameter.class);
        usingGrowthRate = false;
    }
    return new ExpansionModel(N0Param, N1Param, rParam, units, usingGrowthRate);
}
Also used : Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits) ExpansionModel(dr.evomodel.coalescent.ExpansionModel)

Example 67 with Units

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

the class ConstantExponentialModelParser 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_PHASE_START_TIME);
    Parameter timeParam = (Parameter) cxo.getChild(Parameter.class);
    Parameter rParam;
    boolean usingGrowthRate = true;
    if (xo.getChild(GROWTH_RATE) != null) {
        cxo = xo.getChild(GROWTH_RATE);
        rParam = (Parameter) cxo.getChild(Parameter.class);
    } else {
        cxo = xo.getChild(DOUBLING_TIME);
        rParam = (Parameter) cxo.getChild(Parameter.class);
        usingGrowthRate = false;
    }
    return new ConstantExponentialModel(N0Param, timeParam, rParam, units, usingGrowthRate);
}
Also used : ConstantExponentialModel(dr.evomodel.coalescent.ConstantExponentialModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 68 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);
    Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
    return new ConstantPopulationModel(N0Param, units);
}
Also used : ConstantPopulationModel(dr.evomodel.coalescent.ConstantPopulationModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 69 with Units

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

the class ExponentialSawtoothModelParser 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 rParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(WAVELENGTH);
    Parameter wavelengthParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(OFFSET);
    Parameter tParam = (Parameter) cxo.getChild(Parameter.class);
    return new ExponentialSawtoothModel(N0Param, rParam, wavelengthParam, tParam, units);
}
Also used : ExponentialSawtoothModel(dr.evomodel.coalescent.ExponentialSawtoothModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 70 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.setPrecision(date.getPrecision());
        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