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);
}
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);
}
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);
}
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);
}
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();
}
Aggregations