Exemplo n.º 1
0
import matplotlib.pyplot as plt
from BH_mass_function import gene_BHBH, dl, solve_z
import pickle
import glob
import random
import scipy.optimize as op
import time

a, mbh_max, mbh_min = 2.35, 80., 5.
filename = 'sim_a_{0}_max_{1}_min_{2}'.format(round(a, 2), round(mbh_max, 1),
                                              round(mbh_min, 1))
if_file = glob.glob(filename)
if if_file == []:
    event_rate, zs_detected, masses, rhos_detected = test.mc_year_rate(
        a=a, mbh_max=mbh_max, mbh_min=mbh_min)
    dl_zs = dl(zs_detected)
    sim_data = [event_rate, zs_detected, masses, rhos_detected, dl_zs]
    pickle.dump(sim_data, open(filename, 'wb'))
else:
    event_rate, zs_detected, masses, rhos_detected, dl_zs = pickle.load(
        open(filename, 'rb'))
#print "The yearly rate using MC simulating:", event_rate
#
##averaged Chirp mass
#print 'averaged Chirp mass, m1, m2: ', np.average(masses[:,0]), np.average(masses[:,1]), np.average(masses[:,2])
zs, chirp_mass, m1, m2, lumi_dis = zs_detected, masses[:,
                                                       0], masses[:,
                                                                  1], masses[:,
                                                                             2], dl_zs

#plt.hist(masses[:,:2])
Exemplo n.º 2
0
                                              round(mbh_min, 1))
if_file = glob.glob(filename)
if if_file == []:
    event_rate, zs_detected, masses, rhos_detected = test.mc_year_rate(
        a=a, mbh_max=mbh_max, mbh_min=mbh_min)
    sim_data = [event_rate, zs_detected, masses, rhos_detected]
    pickle.dump(sim_data, open(filename, 'wb'))
else:
    event_rate, zs_detected, masses, rhos_detected = pickle.load(
        open(filename, 'rb'))
print "The yearly rate using MC simulating:", event_rate

#averaged Chirp mass
print 'averaged Chirp mass, m1, m2: ', np.average(masses[:, 0]), np.average(
    masses[:, 1]), np.average(masses[:, 2])
lum_dis = dl(zs_detected)
zs, chirp_mass, m1, m2, lumi_dis = zs_detected, masses[:,
                                                       0], masses[:,
                                                                  1], masses[:,
                                                                             2], lum_dis

#plt.hist(masses[:,:2])
#plt.hist(zs_detected)
#plt.hist(m1)
#plt.hist(rhos_detected)
#plt.plot(m1,m2,'.')
##plt.yscale('log', nonposy='clip')
#plt.show()
#import corner
#fig = corner.corner(np.column_stack((m1,m2)), labels=["$m1$", "$m2$"],title_kwargs={"fontsize": 12})
##                    quantiles=[0.16, 0.84],show_titles=True,