Example #1
0
dec_J0045 = coor_J0045.dec.degree
M2_d_J0045 = 8.8  # M2 in Msun
M2_d_J0045_err = 1.8
P_orb_J0045 = 51.17  # P_orb in days
P_orb_J0045_err = 1.0
ecc_J0045 = 0.808  # eccentricity
ecc_J0045_err = 0.05



############## Run sampler ###################
start_time = time.time()


sampler1, sampler2, sampler3, sampler4, sampler = stats.run_emcee_2(M2_d_J0045, P_orb_J0045, ecc_J0045, ra_J0045, dec_J0045, \
    M2_d_err=M2_d_J0045_err, P_orb_obs_err=P_orb_J0045_err, ecc_obs_err=ecc_J0045_err, \
    nburn=10000, nsteps=50000)

print "Simulation took", time.time()-start_time, "seconds"



# Print autocorrelation length
print "Burn-in 1:"
print "Autocorrelation lengths", sampler1.acor
print "Acceptance fraction", sampler1.acceptance_fraction

print "Burn-in 2:"
print "Autocorrelation lengths", sampler2.acor
print "Acceptance fraction", sampler2.acceptance_fraction
Example #2
0
x = M1, M2, A, ecc, v_k, theta, phi, ra_b, dec_b, t_b
y = ra_obs, dec_obs, M1, M2, A, ecc, v_k, theta, phi, ra_b, dec_b, t_b
args = M2_obs, M2_d_err, P_obs, P_orb_obs_err, ecc_obs, ecc_obs_err, ra_obs, dec_obs

prior_truths = stats.ln_priors(y)
posterior_truths = stats.ln_posterior(x, args)
print "Prior:", prior_truths
print "Posterior:", posterior_truths



############## Run sampler ###################
start_time = time.time()

sampler1, sampler2, sampler3, sampler4, sampler = stats.run_emcee_2(M2_obs, P_obs, ecc_obs, ra_obs, dec_obs, \
    M2_d_err=M2_d_err, P_orb_obs_err=P_orb_obs_err, ecc_obs_err=ecc_obs_err, \
    nwalkers=80, nburn=10000, nsteps=50000)

print "Simulation took", time.time()-start_time, "seconds"




# Print autocorrelation length
print "Burn-in 1:"
print "Autocorrelation lengths", sampler1.acor
print "Acceptance fraction", sampler1.acceptance_fraction

print "Burn-in 2:"
print "Autocorrelation lengths", sampler2.acor
print "Acceptance fraction", sampler2.acceptance_fraction