Commit 286ae756 authored by hannah's avatar hannah

updating the plotting script wiht new location of results

parent 9643ea96
...@@ -8,29 +8,15 @@ matplotlib.rcParams.update({'font.size': 16}) ...@@ -8,29 +8,15 @@ matplotlib.rcParams.update({'font.size': 16})
def getAGNPost(nFreqBins): def getAGNPost(nFreqBins):
if nFreqBins==9: # read in the posterior files for the chosen number of frequency bins
path0 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq9/posterior.dat'.format(nFreqBins) path0 = '../results/agnosticPosterior/nFreq{}/posterior_0.dat'.format(nFreqBins)
path1 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq9_1/posterior.dat'.format(nFreqBins) path1 = '../results/agnosticPosterior/nFreq{}/posterior_1.dat'.format(nFreqBins)
path2 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq9_2/posterior.dat'.format(nFreqBins) path2 = '../results/agnosticPosterior/nFreq{}/posterior_2.dat'.format(nFreqBins)
post0 = np.genfromtxt(path0,names=True) post0 = np.genfromtxt(path0,names=True)
post1 = np.genfromtxt(path1,names=True) post1 = np.genfromtxt(path1,names=True)
post2 = np.genfromtxt(path2,names=True) post2 = np.genfromtxt(path2,names=True)
elif nFreqBins==5:
path0 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq5/posterior.dat'.format(nFreqBins) # combine the posteriors
path1 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq5_1/posterior.dat'.format(nFreqBins)
path2 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq5_2/posterior.dat'.format(nFreqBins)
post0 = np.genfromtxt(path0,names=True)
post1 = np.genfromtxt(path1,names=True)
post2 = np.genfromtxt(path2,names=True)
elif nFreqBins==3:
path0 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq3/posterior.dat'.format(nFreqBins)
path1 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq3_1/posterior.dat'.format(nFreqBins)
path2 = '/home/ADF/middlehr/Documents/PTA/EPTAInterp/results/agn_model/f{}/nFreq3_2/posterior.dat'.format(nFreqBins)
post0 = np.genfromtxt(path0,names=True)
post1 = np.genfromtxt(path1,names=True)
post2 = np.genfromtxt(path2,names=True)
#combine the ns
post0And1 = np.concatenate((post0['logn'], post1['logn'])) post0And1 = np.concatenate((post0['logn'], post1['logn']))
logns = np.concatenate((post0And1, post2['logn'])) logns = np.concatenate((post0And1, post2['logn']))
...@@ -46,6 +32,7 @@ def getAGNPost(nFreqBins): ...@@ -46,6 +32,7 @@ def getAGNPost(nFreqBins):
post0And1 = np.concatenate((post0['gamma'], post1['gamma'])) post0And1 = np.concatenate((post0['gamma'], post1['gamma']))
gammas = np.concatenate((post0And1, post2['gamma'])) gammas = np.concatenate((post0And1, post2['gamma']))
# make a dictionary with the full results
posteriorCombined = {'logn': logns, posteriorCombined = {'logn': logns,
'alpha': alphas, 'alpha': alphas,
'delta': deltas, 'delta': deltas,
...@@ -70,26 +57,53 @@ def fiveDCorner(data,nFBins): ...@@ -70,26 +57,53 @@ def fiveDCorner(data,nFBins):
r'$\beta_z$', r'$z_0$', r'$\alpha_{\mathcal{M}}$',\ r'$\beta_z$', r'$z_0$', r'$\alpha_{\mathcal{M}}$',\
r'$\log_{10} \frac{\mathcal{M}_*}{ M_{\odot}}$']) r'$\log_{10} \frac{\mathcal{M}_*}{ M_{\odot}}$'])
plt.clf()
figure = corner.corner(d2,labels=parameterLabels, figure = corner.corner(d2,labels=parameterLabels,
quantiles=[0.05, 0.5, 0.95]) quantiles=[0.05, 0.5, 0.95])
plt.savefig('forPaper/agn_fullCorner_fBins{}.pdf'.format(nFBins)) plt.savefig('agn_fullCorner_fBins{}.pdf'.format(nFBins))
plt.savefig('forPaper/agn_fullCorner_fBins{}.png'.format(nFBins)) plt.savefig('agn_fullCorner_fBins{}.png'.format(nFBins))
plt.show()
return return
n=9 def oneDimensionalHistograms(data,nFBins):
posterior = getAGNPost(n)#np.genfromtxt('posterior.dat', names=True)
fiveDCorner(posterior,n)
# individual one dimensional plots
names = ['logn', 'beta', 'gamma', 'alpha', 'delta']
parameterLabels = ([r'$\log_{10}\frac{{\dot n}_0}{{\rm Mpc}^{3}{\rm Gyr}}$',\
r'$\beta_z$', r'$z_0$', r'$\alpha_{\mathcal{M}}$',\
r'$\log_{10} \frac{\mathcal{M}_*}{ M_{\odot}}$'])
for i in range(len(names)):
oneDData = data[names[i]]
plt.clf()
plt.hist(oneDData,histtype='step')
plt.xlabel(parameterLabels[i])
plt.ylabel('count')
plt.tight_layout()
plt.show()
def main():
# choose the number of frequency bins to use
n=9
# full corner plot
posterior = getAGNPost(n)
fiveDCorner(posterior,n)
# one dimensional histograms
oneDimensionalHistograms(posterior,n)
exit()
names = ['logn', 'beta', 'gamma', 'alpha', 'delta']
for i in range(5):
oneDData = posterior[names[i]]
# percentile:
plt.hist(oneDData) if __name__=='__main__':
plt.show() main()
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