Commit 9807d91e authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

fix output file names

parent cd50da76
......@@ -323,7 +323,8 @@ void MCMC_adaptive::fill_chain(pdf* target_func, pdf* proposal,int init_step, co
int gate=_bunchSize;
if(i%gate==0)
{
if (_verbose) cout << "dump at index " << i << " from " << i-gate << " to " << i-1 << endl;
//if (_verbose) cout << "dump at index " << i << " from " << i-gate << " to " << i-1 << endl;
cout << i << " written" <<endl;
chain_running.open (chain_run_name, fstream::app);
for(int k=i-gate; k<i; k++)
......
......@@ -136,7 +136,7 @@ void MCMC_sampler::write_chain(char* str)
}
void MCMC_sampler::write_if_useful(vector<double>& vec,char* str)
void MCMC_sampler::write_if_useful(vector<double>& vec,const char* str)
{
cout << "output written in:"<< str << endl;
......@@ -149,7 +149,7 @@ void MCMC_sampler::write_if_useful(vector<double>& vec,char* str)
}
void MCMC_sampler::write_vecHep(vector<HepVector >& vec,char* str)
void MCMC_sampler::write_vecHep(vector<HepVector >& vec,const char* str)
{
cout << "output written in:"<< str << endl;
......
......@@ -67,8 +67,8 @@ public:
void compute_mean(int stop,HepVector mean);
void write_rearranged_chain(char* str); //rec, value, lkh
void set_par(Parser parser); // set parameters value using Parser
void write_if_useful(std::vector<double>& vec,char* str);
void write_vecHep(std::vector<HepVector >& vec,char* str);
void write_if_useful(std::vector<double>& vec,const char* str);
void write_vecHep(std::vector<HepVector >& vec,const char* str);
//accessors
......
......@@ -48,7 +48,12 @@ int main(int argc, char *argv[])
std::cout << "output file " + fileName + " already exists: removing it"<<endl;
remove_file(fileName);
}
string ar_file=string("ar_vs_length_")+fileName;
string scale_file=string("scale_")+fileName;
string cor_file=string("prop_cov_")+fileName;
cout << "output files:" <<endl;
cout << ar_file << " " << scale_file << " " << cor_file << " " << endl;
//MCMC specific parameters
const string algo=parser.params.find<string>("algo","ada");
......@@ -151,8 +156,7 @@ int main(int argc, char *argv[])
if(use_ext_cov)
{
cout << "Read proposal cov matrix.." << endl;
cout << proposal_cov.c_str() << endl;
cout << "Read proposal cov matrix=" << proposal_cov.c_str() << endl;
proposal->set_cov(proposal_cov.c_str());
}
else {
......@@ -245,21 +249,21 @@ int main(int argc, char *argv[])
{ar_vs_length.push_back(chain->acc_rate(0,step));}
}
chain->write_if_useful(ar_vs_length,"ar_vs_length.txt");
chain->write_if_useful(ar_vs_length,ar_file.c_str());
if(algo=="ada")
{
MCMC_adaptive* ada=dynamic_cast<MCMC_adaptive*>(chain);
chain->write_if_useful(proposal->_scale_vs_length,"scale_vs_length.txt");
chain->write_if_useful(proposal->_scale_vs_length,scale_file.c_str());
ofstream f("corr.txt");
ofstream f(cor_file.c_str());
if(!f) {
cout << "Error in file creation!";
}
f << ada->mean() << endl //mean
<< proposal->Get_cov_matrix() << endl; //cov matrix
f.close();
cout<<"output written in:corr.txt"<<endl;;
cout<<"proposal cov written in " << cor_file <<endl;;
}
delete chi2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment