Commit e2a37d04 authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

add possibility to write fits file at end of MCMC

parent 62481f9a
......@@ -447,9 +447,9 @@ MCMC_sampler::write_samples_fits(const char* fn) {
//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> tab(val.size());
for (size_t j=0;j<tab.size();j++) tab[j]=val[i];
HepVector& vec=_value_chain[i];
arr<double> tab(vec.num_row());
for (size_t j=0;j<tab.size();j++) tab[j]=vec[i];
fout.write_column(i+1,tab);
}
......
......@@ -31,7 +31,7 @@ using namespace std;
int main(int argc, char *argv[])
{
planck_assert(argc!=3,"Usage: mcmc parfile(in) samplesfile(out) ");
planck_assert(argc==3 || argc==4,"Usage: mcmc parfile(in) txtfile(out) (outfitsname)");
planck_assert(file_present(argv[1]),"missing par file");
......@@ -231,6 +231,10 @@ int main(int argc, char *argv[])
cout<<"output written in:corr.txt"<<endl;;
}
//write optionally fits output:
if (argc==4)
chain->write_samples_fits(argv[3]);
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