Search in sources :

Example 1 with GaussianProcessSkytrackTreeOperator

use of dr.evomodel.coalescent.operators.GaussianProcessSkytrackTreeOperator in project beast-mcmc by beast-dev.

the class GaussianProcessSkytrackTreeOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    //        boolean logRecord = xo.getAttribute(KEEP_LOG_RECORD, false);
    //        Handler gmrfHandler;
    //        Logger gmrfLogger = Logger.getLogger("dr.evomodel.coalescent.operators.GaussianProcessSkytrackBlockUpdateOperator");
    //        gmrfLogger.setUseParentHandlers(false);
    //        if (logRecord) {
    //            gmrfLogger.setLevel(Level.FINE);
    //
    //            try {
    //                gmrfHandler = new FileHandler("GPBlockUpdate.log." + MathUtils.getSeed());
    //            } catch (IOException e) {
    //                throw new RuntimeException(e.getMessage());
    //            }
    //            gmrfHandler.setLevel(Level.FINE);
    //
    //            gmrfHandler.setFormatter(new XMLFormatter() {
    //                public String format(LogRecord record) {
    //                    return "<record>\n \t<message>\n\t" + record.getMessage()
    //                            + "\n\t</message>\n<record>\n";
    //                }
    //            });
    //
    //            gmrfLogger.addHandler(gmrfHandler);
    //        }
    CoercionMode mode = CoercionMode.parseMode(xo);
    if (mode == CoercionMode.DEFAULT)
        mode = CoercionMode.COERCION_ON;
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    double scaleFactor = xo.getDoubleAttribute(SCALE_FACTOR);
    //            if (scaleFactor <= 0.0) {
    //                throw new XMLParseException("scaleFactor must be greater than 0.0");
    //        if (scaleFactor < 1.0) {
    //            throw new XMLParseException("scaleFactor must be greater than or equal to 1.0");
    //        }
    //        int maxIterations = xo.getAttribute(MAX_ITERATIONS, 200);
    //        double stopValue = xo.getAttribute(STOP_VALUE, 0.01);
    GaussianProcessSkytrackLikelihood gpLikelihood = (GaussianProcessSkytrackLikelihood) xo.getChild(GaussianProcessSkytrackLikelihood.class);
    TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
    return new GaussianProcessSkytrackTreeOperator(treeModel, gpLikelihood, weight, scaleFactor, mode);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) GaussianProcessSkytrackTreeOperator(dr.evomodel.coalescent.operators.GaussianProcessSkytrackTreeOperator) GaussianProcessSkytrackLikelihood(dr.evomodel.coalescent.GaussianProcessSkytrackLikelihood) CoercionMode(dr.inference.operators.CoercionMode)

Aggregations

GaussianProcessSkytrackLikelihood (dr.evomodel.coalescent.GaussianProcessSkytrackLikelihood)1 GaussianProcessSkytrackTreeOperator (dr.evomodel.coalescent.operators.GaussianProcessSkytrackTreeOperator)1 TreeModel (dr.evomodel.tree.TreeModel)1 CoercionMode (dr.inference.operators.CoercionMode)1