Commit 91b179ef authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

add public accessors

parent 6795ee9a
......@@ -10,6 +10,8 @@
#include <iostream>
#include <fstream>
#include"arr.h"
#include"fitshandle.h"
using namespace std;
MCMC_sampler::MCMC_sampler()
......@@ -427,4 +429,28 @@ void MCMC_sampler::set_par(Parser parser)
}
void
MCMC_sampler::write_samples_fits(const char* fn) {
const std::string fileName(fn);
cout << "writing FITS file=" << fileName << endl;
if (file_present(fileName)) {
std::cout << "the file " + fileName + " already exists: removing it"<<endl;
remove_file(fileName);
}
fitshandle fout(fileName,fitshandle::CREATE, READWRITE);
std::vector<fitscolumn> cols;
//define columns
for (size_t i=0;i< _par_name.size();i++){
cols.push_back(fitscolumn(_par_name[i], "?",1,TDOUBLE));
}
fout.insert_bintab (cols);
//convert to arr and write staring at index 1
for (size_t i=0;i< _par_name.size();i++){
HepVector& val=_value_chain[i];
arr<double> var;
fout.write_column(i+1,var);
}
}
......@@ -56,8 +56,8 @@ int main(int argc, char *argv[])
const int seed=parser.params.find<int>("seed",length);
const bool use_ext_cor=(proposal_cor.size()!=string::npos);
bool use_ext_cov=(proposal_cov.size()!=string::npos);
const bool use_ext_cor=(proposal_cor.size()!=0);
bool use_ext_cov=(proposal_cov.size()!=0);
//---------------------------------------------------------
......
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