I added some code to fit_mcmc.cpp to write out the chain to a fits file