Search in sources :

Example 46 with XMLParser

use of beast.util.XMLParser in project beast2 by CompEvol.

the class TestFramework method analyse.

// protected abstract void analyse() throws Exception;
public void analyse(int index_XML) throws Exception {
    // for (int i = 0; i < xmls.length; i++) {
    // if (giveExpectations(i).size() > 0) {
    Randomizer.setSeed(SEED);
    Logger.FILE_MODE = Logger.LogFileMode.overwrite;
    long beagleFlags = BeagleFlag.PROCESSOR_CPU.getMask() | BeagleFlag.VECTOR_SSE.getMask();
    System.setProperty("beagle.preferred.flags", Long.toString(beagleFlags));
    String fileName = dirName + xmls[index_XML];
    System.out.println("Processing " + fileName);
    XMLParser parser = new XMLParser();
    beast.core.Runnable runable = parser.parseFile(new File(fileName));
    runable.setStateFile("tmp.state", false);
    // runable.setInputValue("preBurnin", 0);
    // runable.setInputValue("chainLength", 1000);
    runable.run();
    String logFile = logDir + testFile + (useSeed ? SEED : "") + ".log";
    System.out.println("\nAnalysing log " + logFile);
    // burnIn = 0.1 * maxState
    LogAnalyser logAnalyser = new LogAnalyser(logFile, giveExpectations(index_XML));
    for (Expectation expectation : logAnalyser.m_pExpectations.get()) {
        Assert.assertTrue(xmls[index_XML] + ": Expected " + expectation.traceName.get() + " delta mean: " + expectation.expValue.get() + " - " + expectation.getTraceStatistics().getMean() + " <= delta stdErr: 2*(" + expectation.getStdError() + " + " + expectation.getTraceStatistics().getStdErrorOfMean() + ")", expectation.isPassed());
        if (checkESS)
            Assert.assertTrue(xmls[index_XML] + ":  has very low effective sample sizes (ESS) " + expectation.getTraceStatistics().getESS(), expectation.isValid());
    }
    System.out.println("\nSucceed " + fileName);
    System.out.println("\n***************************************\n");
// }
// }
}
Also used : LogAnalyser(test.beast.beast2vs1.trace.LogAnalyser) XMLParser(beast.util.XMLParser) Expectation(test.beast.beast2vs1.trace.Expectation) File(java.io.File)

Aggregations

XMLParser (beast.util.XMLParser)46 File (java.io.File)36 ArrayList (java.util.ArrayList)29 Test (org.junit.Test)27 Expectation (test.beast.beast2vs1.trace.Expectation)23 LogAnalyser (test.beast.beast2vs1.trace.LogAnalyser)23 BEASTInterface (beast.core.BEASTInterface)11 XMLProducer (beast.util.XMLProducer)5 IOException (java.io.IOException)5 FilenameFilter (java.io.FilenameFilter)4 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)4 SAXException (org.xml.sax.SAXException)4 MCMC (beast.core.MCMC)3 Alignment (beast.evolution.alignment.Alignment)3 XMLParserException (beast.util.XMLParserException)3 BufferedReader (java.io.BufferedReader)3 FileReader (java.io.FileReader)3 Input (beast.core.Input)2 StateNode (beast.core.StateNode)2 CompoundDistribution (beast.core.util.CompoundDistribution)2