warnings.simplefilter("ignore")#Used to suppress the RuntimeWarnings. But if you are changing the code for TESTING, MAKE SURE TO COMMENT IT OUT.
'''
This script calculates the RDGW150914 constraints with ptemcee - specifically, the n=1 case varying the fundamental frequencies, tshift = 0. It produces the chain plot, corner plot, parameter constraints, and data plotted with the 1-sigma band. Since we are working specifically for the n=1 case, we also compare alpha_0 and alpha_1 in a histogram, in order to demonstrate that the two are indistinguishable with each other.
Rising from the ashes.
--- R^a_{yne} L^i_u, 08/09/2020
Adapted to include the nmax = 0 case.
---R^a_{yne} L^i_u, 08/20/2020, don't know what to do now
--- R^a_{yne} L^i_u, 08/22/2020
'''
importnumpyasnp
...
...
@@ -38,18 +34,18 @@ import random
#tshift: time shift after the strain peak
#vary_fund: whether you vary the fundamental frequency. Works in the model_dv function.
rootpath="/work/rayne.liu"#"/Users/RayneLiu"
rootpath="/Users/RayneLiu"#"/work/rayne.liu"
nmax=0
tshift=0
vary_fund=False
#sampler parameters
npoints=2512
nwalkers=1256
npoints=240
nwalkers=120
ntemps=16
dim=nmax+1
ndim=4*dim
burnin=1256#How many points do you burn before doing the corner plot. You need to watch the convergence of the chain plot a bit.
burnin=120#How many points do you burn before doing the corner plot. You need to watch the convergence of the chain plot a bit.
#This is trivial but often forgotten: this cannot be more than npoints! Usually 1/5~1/4 npoints is what I observe.
numbins=42#corner plot parameter - how many bins you want
#The autocorrelation time, this time I don't intend to delete alpha0 and beta0, just keep the nan's there since we don't really use this data, only look at it. It's good to keep it for sanity check's sake.
atcrr=sampler.get_autocorr_time()[0]
df4=pd.DataFrame(atcrr,index=paramlabels,columns=[r'Autocorrelation time, vary='+str(vary_fund)+', nmax='+str(nmax)+', tshift='+str(tshift)+', '+str(npoints)+'pts'])