Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PTAInterpretation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Schedules
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Hannah Middleton
PTAInterpretation
Commits
286ae756
Commit
286ae756
authored
Apr 24, 2026
by
hannah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating the plotting script wiht new location of results
parent
9643ea96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
37 deletions
+51
-37
agn_corner.py
plotting/agn_corner.py
+51
-37
No files found.
plotting/agn_corner.py
View file @
286ae756
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment