예제 #1
0
 @Override
 protected boolean requiresRecalculation() {
   final TreeIntervals ti = treeIntervalsInput.get();
   if (ti != null) {
     // boolean d = ti.isDirtyCalculation();
     // assert d;
     assert ti.isDirtyCalculation();
     return true;
   }
   return treeInput.get().somethingIsDirty();
 }
예제 #2
0
  @Override
  public void initAndValidate() throws Exception {
    popFunction = popFunctionInput.get();
    popSizesBottom = popSizesBottomInput.get();
    popSizesTop = popSizesTopInput.get();

    // set up sizes of population functions
    final int nSpecies = treeInput.get().getLeafNodeCount();
    final int nNodes = treeInput.get().getNodeCount();
    switch (popFunction) {
      case constant:
        popSizesBottom.setDimension(nNodes);
        break;
      case linear:
        if (popSizesTop == null) {
          throw new Exception("topPopSize must be specified");
        }
        popSizesBottom.setDimension(nSpecies);
        popSizesTop.setDimension(nNodes);
        break;
      case linear_with_constant_root:
        if (popSizesTop == null) {
          throw new Exception("topPopSize must be specified");
        }
        popSizesBottom.setDimension(nSpecies);
        popSizesTop.setDimension(nNodes - 1);
        break;
    }

    // bottom prior = Gamma(2,Psi)
    gamma2Prior = new Gamma();
    gamma2Prior.betaInput.setValue(gammaParameterInput.get(), gamma2Prior);

    // top prior = Gamma(4,Psi)
    gamma4Prior = new Gamma();
    final RealParameter parameter = new RealParameter(new Double[] {4.0});
    gamma4Prior.alphaInput.setValue(parameter, gamma4Prior);
    gamma4Prior.betaInput.setValue(gammaParameterInput.get(), gamma4Prior);

    if (popFunction != PopSizeFunction.constant && gamma4Prior == null) {
      throw new Exception("Top prior must be specified when population function is not constant");
    }
    // make sure the m_taxonSet is a set of taxonsets
    // HACK to make Beauti initialise: skip the check here
    //		for (Taxon taxon : m_taxonSet.get().m_taxonset.get()) {
    //			if (!(taxon instanceof TaxonSet)) {
    //				throw new Exception("taxonset should be sets of taxa only, not individual taxons");
    //			}
    //		}
  }
예제 #3
0
 @Override
 public void initAndValidate() throws Exception {
   _lower = lowerInput.get();
   _upper = upperInput.get();
   if (_lower >= _upper) {
     throw new Exception("Upper value should be higher than lower value");
   }
   distr.setBounds(_lower, _upper);
   infiniteSupport = Double.isInfinite(_lower) || Double.isInfinite(_upper);
   if (infiniteSupport) {
     density = 1.0;
   } else {
     density = 1.0 / (_upper - _lower);
   }
 }