import numpy as np
import matplotlib.pyplot as plt

pathToResults = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/gal_model/f9/'
run='ptmcmc_f9_2'
name = '_f9_2'


chains = np.genfromtxt(pathToResults+run+'/output/chain_1.txt')

nparameters = 18
fig, axes = plt.subplots(nparameters, figsize=(10, 10), sharex=True)

labels = np.genfromtxt('pars.txt',dtype=str)
print(labels)
#labels = ["m", "b", "log(f)"]
for i in range(nparameters):
    ax = axes[i]
    ax.plot(chains[:,i], "k", alpha=0.7)
    ax.set_xlim(0, len(chains))
    ax.set_ylabel(labels[i],rotation=0)
    ax.yaxis.set_label_coords(-0.1, 0.5)



axes[-1].set_xlabel("step number");


plt.savefig('{0}{1}/chains{2}.png'.format(pathToResults,run,name))
plt.show()
