-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·69 lines (59 loc) · 2.43 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <CommandLineOptions.h>
#include <MTSampler.h>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include "FermiModelOptions.h"
#include "MyOptions.h"
#include "FermiModel.h"
#include "FermiData.h"
#include "SloanModelOptions.h"
#include "SloanData.h"
#include "SloanModel.h"
using namespace std;
using namespace DNest3;
using boost::property_tree::ptree;
int main(int argc, char** argv)
{
CommandLineOptions options(argc, argv);
std::cout<<"# Using "<<options.get_numThreads()<<" thread"<<
((options.get_numThreads() == 1)?("."):("s."))<<std::endl;
std::cout<<"# Target compression factor between levels = ";
std::cout<<options.get_compression()<<std::endl;
// Seed random number generator
std::cout<<"# Seeding random number generator with "<<
options.get_seed_long()<<"."<<std::endl;
RandomNumberGenerator::initialise_instance();
RandomNumberGenerator::get_instance().set_seed(options.get_seed_long());
// Load sampler options from file
// Added option to specify output file name
MyOptions samplerOptions(options.get_configFile().c_str(), options.set_gzip());
ptree pt;
read_xml("run-"+options.get_configFile()+"/OPTIONS-MODEL", pt);
// TODO look at Start file?
// must load data, then model options, before creating sampler
// then load levels file if requested
string model = pt.get<string>("modeloptions.model");
if (model == "fermi"){
FermiData::get_instance().load(("Data/"+options.get_dataFile()+"_cts.txt").c_str(),
("Data/"+options.get_dataFile()+"_exp.txt").c_str(),
("Data/"+options.get_dataFile()+"_pix.txt").c_str(),
("Data/"+options.get_dataFile()+"_tem.txt").c_str());
FermiModelOptions::get_instance().load(pt);
MTSampler<FermiModel> sampler(options.get_numThreads(), options.get_compression_double(), samplerOptions);
if(options.get_levelsFile().compare("") != 0)
sampler.loadLevels(options.get_levelsFile().c_str());
sampler.run();
}
if (model == "sloan"){
SloanData::get_instance().load(("Data/"+options.get_dataFile()+"_cts.txt").c_str(),
("Data/"+options.get_dataFile()+"_psf.txt").c_str(),
("Data/"+options.get_dataFile()+"_pix.txt").c_str());
SloanModelOptions::get_instance().load(pt);
MTSampler<SloanModel> sampler(options.get_numThreads(), options.get_compression_double(), samplerOptions);
if(options.get_levelsFile().compare("") != 0)
sampler.loadLevels(options.get_levelsFile().c_str());
sampler.run();
}
return 0;
}