def add_standard_sampling_run(self): """ Add the <run> element (only) for a standard analysis, i.e. without path sampling. The <state>, <init> etc. are added to whatever this method names self.run. """ self.run = xml.run( self.beast, id="mcmc", spec="MCMC", chainLength=self.config.mcmc.chainlength, numInitializationAttempts=1000, sampleFromPrior=self.config.mcmc.sample_from_prior, )
def add_path_sampling_run(self): """ Add the <run> element (only) for a path sampling analysis. We call this self.ps_run and assign the nested <mcmc> element to self.run, so that <state>, <init> etc. will be correctly added there. """ attribs = { "id": "ps", "spec": "beast.inference.PathSampler", "chainLength": self.config.mcmc.chainlength, "nrOfSteps": self.config.mcmc.steps, "alpha": self.config.mcmc.alpha, "rootdir": self.config.admin.basename + "_path_sampling", "preBurnin": int((self.config.mcmc.preburnin / 100) * self.config.mcmc.chainlength), "burnInPercentage": self.config.mcmc.log_burnin, "deleteOldLogs": "true", } if self.config.mcmc.do_not_run: attribs["doNotRun"] = "true" self.ps_run = xml.run(self.beast, attrib=attribs) self.ps_run.text = """cd $(dir) java -cp $(java.class.path) beast.app.beastapp.BeastMain $(resume/overwrite) -java -seed $(seed) beast.xml""" attribs = {} attribs["id"] = "mcmc" attribs["spec"] = "MCMC" attribs["chainLength"] = str(self.config.mcmc.chainlength) self.run = xml.mcmc(self.ps_run, attrib=attribs)
def test_nesting(): e = xml.beast() xml.run(xml.beast()) for ee in e: assert ee.tag == 'run'
def test_subelement(kw, assertion): assert assertion(xml.run(None, **kw))