Exemplo n.º 1
0
import numpy as np
import time

import matplotlib
matplotlib.use('Agg')

sys.path.append("../pyBSE/")
import pybse
import dart_board
from dart_board import sf_history

LMC_metallicity = 0.008

pub = dart_board.DartBoard("HMXB",
                           evolve_binary=pybse.evolve,
                           ln_prior_pos=sf_history.lmc.prior_lmc,
                           metallicity=LMC_metallicity,
                           nwalkers=320,
                           threads=20)

pub.aim_darts()

start_time = time.time()
pub.throw_darts(nburn=2, nsteps=120000)
print("Simulation took", time.time() - start_time, "seconds.")

# Acceptance fraction
print("Acceptance fractions:", pub.sampler.acceptance_fraction)

# Autocorrelation length
try:
    print("Autocorrelation length:", pub.sample.acor)
Exemplo n.º 2
0
sys.path.append("../pyBSE/")
import pybse
import dart_board
from dart_board import sf_history

# Values for mock system 1
# Input values: 11.77 8.07 4850.81 0.83 153.04 2.05 2.33 34.74
# Output values: 1.48 8.09 179.89 0.68 39.65 1.32e-12 22.12 13 1

LMC_metallicity = 0.008

system_kwargs = {"M2": 7.7, "M2_err": 0.5, "ecc": 0.69, "ecc_err": 0.05}
pub = dart_board.DartBoard("NSHMXB",
                           evolve_binary=pybse.evolve,
                           nwalkers=320,
                           threads=20,
                           metallicity=LMC_metallicity,
                           thin=100,
                           system_kwargs=system_kwargs)

pub.aim_darts(N_iterations=100000, a_set='high')

start_time = time.time()
pub.throw_darts(nburn=2, nsteps=150000)
print("Simulation took", time.time() - start_time, "seconds.")

# Acceptance fraction
print("Acceptance fractions:", pub.sampler.acceptance_fraction)

# Autocorrelation length
try:
Exemplo n.º 3
0
    "M2": 7.84,
    "M2_err": 0.25,
    "P_orb": 14.11,
    "P_orb_err": 1.0,
    "ecc": 0.47,
    "ecc_err": 0.05,
    "L_x": 1.94e33,
    "L_x_err": 1.0e32,
    "ra": 83.5744461,
    "dec": -69.4876344
}
pub = dart_board.DartBoard("HMXB",
                           evolve_binary=pybse.evolve,
                           ln_prior_pos=sf_history.lmc.prior_lmc,
                           nwalkers=320,
                           threads=20,
                           ntemps=10,
                           metallicity=LMC_metallicity,
                           thin=100,
                           system_kwargs=system_kwargs)

# Darts need to be in ln
pub.aim_darts(N_iterations=200000, a_set='low')

start_time = time.time()
pub.throw_darts(nburn=2, nsteps=150000)
print("Simulation took", time.time() - start_time, "seconds.")

# Since emcee_PT does not have a blobs function, we must include the following calculation
if pub.chains.ndim == 4:
Exemplo n.º 4
0
    dec_J0513 = -65.7885278

    # Restrict size of viable region to within 2 degrees of J0513
    if np.abs(ra - ra_J0513)*np.cos(dec*np.pi/180.0) > 2.0: return -np.inf
    if np.abs(dec - dec_J0513) > 2.0: return -np.inf

    return sf_history.lmc.prior_lmc(ra, dec, ln_t_b)






# Values for Swift J0513.4-6547 from Coe et al. 2015, MNRAS, 447, 1630
pub = dart_board.DartBoard("NSHMXB", evolve_binary=pybse.evolve, metallicity=LMC_metallicity,
                           ln_prior_pos=lmc_sfh_J0513,
                           nwalkers=320, threads=20, thin=10)

pub.aim_darts(N_iterations=10000)


start_time = time.time()
pub.throw_darts(nburn=2, nsteps=150000)
print("Simulation took",time.time()-start_time,"seconds.")




# Since emcee_PT does not have a blobs function, we must include the following calculation

if pub.ntemps is not None:
Exemplo n.º 5
0
import sys
import numpy as np
import time

import matplotlib
matplotlib.use('Agg')

sys.path.append("../pyBSE/")
import pybse
import dart_board

pub = dart_board.DartBoard("HMXB", evolve_binary=pybse.evolve, nwalkers=320, threads=20)
pub.aim_darts()


start_time = time.time()
pub.throw_darts(nburn=2, nsteps=120000)
print("Simulation took",time.time()-start_time,"seconds.")

# Acceptance fraction
print("Acceptance fractions:",pub.sampler.acceptance_fraction)

# Autocorrelation length
try:
    print("Autocorrelation length:", pub.sample.acor)
except:
    print("Acceptance fraction is too low.")



# Save outputs
Exemplo n.º 6
0
LMC_metallicity = 0.008

system_kwargs = {
    "P_orb": 27.405,
    "P_orb_err": 0.5,
    "ecc_max": 0.17,
    "m_f": 9.9,
    "m_f_err": 2.0,
    "ra": 78.36775,
    "dec": -65.7885278
}
pub = dart_board.DartBoard("NSHMXB",
                           evolve_binary=pybse.evolve,
                           metallicity=LMC_metallicity,
                           ln_prior_pos=sf_history.lmc.prior_lmc,
                           generate_pos=sf_history.lmc.get_random_positions,
                           nwalkers=320,
                           system_kwargs=system_kwargs)
# pub.aim_darts()

start_time = time.time()
pub.scatter_darts(seconds=467648)
# pub.throw_darts(nburn=50000, nsteps=50000)
print("Simulation took", time.time() - start_time, "seconds.")

# Save outputs
np.save("../data/J0513_trad_chain.npy", pub.chains)
np.save("../data/J0513_trad_derived.npy", pub.derived)
np.save("../data/J0513_trad_lnprobability.npy", pub.lnprobability)