17 m_parser = std::make_unique<MaCh3ArgumentParser>(
"diag",
"1.0", argparse::default_arguments::help);
18 m_parser->add_description(
"Tool for MCMC diagnostic like autocorrelations.");
19 m_parser->add_argument(
"mcmc-output")
20 .help(
"MCMC chain root file.")
21 .metavar(
"MCMC_CHAIN")
37 std::string inputFile =
m_parser->get<std::string>(
"mcmc-output");
38 std::string config =
m_parser->get<std::string>(
"config");
45 auto Processor = std::make_unique<MCMCProcessor>(inputFile);
46 Processor->SetOutputSuffix(
"_MCMC_Diag");
48 Processor->SetExcludedTypes(
GetFromManager<std::vector<std::string>>(Settings[
"DiagMCMC"][
"ExcludedTypes"], {}, __FILE__, __LINE__));
49 Processor->SetExcludedNames(
GetFromManager<std::vector<std::string>>(Settings[
"DiagMCMC"][
"ExcludedNames"], {}, __FILE__, __LINE__));
50 Processor->SetExcludedGroups(
GetFromManager<std::vector<std::string>>(Settings[
"DiagMCMC"][
"ExcludedGroups"], {}, __FILE__, __LINE__));
51 Processor->SetPlotRelativeToPrior(GetFromManager<bool>(Settings[
"DiagMCMC"][
"PlotRelativeToPrior"],
false, __FILE__, __LINE__));
53 Processor->SetnBatches(GetFromManager<int>(Settings[
"DiagMCMC"][
"nBatches"], 20, __FILE__, __LINE__));
54 Processor->SetnLags(GetFromManager<int>(Settings[
"DiagMCMC"][
"nLags"], 25000, __FILE__, __LINE__));
55 Processor->SetPrintToPDF(GetFromManager<bool>(Settings[
"PrintToPDF"],
true, __FILE__, __LINE__));
56 Processor->Initialise();
57 if(Settings[
"MaxEntries"]) {
58 Processor->SetEntries(Get<int>(Settings[
"MaxEntries"], __FILE__, __LINE__));
61 Processor->DiagMCMC();
Module for MCMC diagnostic analysis.
void SetMaCh3LoggerFormat()
Set messaging format of the logger.
Type GetFromManager(const YAML::Node &node, const Type defval, const std::string &File, const int Line)
Get content of config file if node is not found take default value specified.
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
MaCh3ArgumentParser * get_parser() override
Get the argument parser for this module.
virtual ~DiagMCMCModule()
Destructor.
int Run() override
Execute the MCMC diagnostics.
Extended ArgumentParser with MaCh3-specific functionality.
std::unique_ptr< MaCh3ArgumentParser > m_parser
Argument parser for this plugin.
Main namespace for MaCh3 software.