Evolving multiple binaries¶
Following on from evolving a single binary, we can also evolve multiple binaries. Let’s start by importing the necessary modules:
In [1]: from cosmic.sample.initialbinarytable import InitialBinaryTable
In [2]: from cosmic.evolve import Evolve
And use the same BSE dict as before:
In [3]: BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 1, 'zsun' : 0.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim': 1}
Below is an example for systems that could form GW150914 and GW170817 - like binaries.
In [4]: binary_set = InitialBinaryTable.InitialBinaries(m1=[85.543645, 11.171469], m2=[84.99784, 6.67305],
...: porb=[446.795757, 170.758343], ecc=[0.448872, 0.370],
...: tphysf=[13700.0, 13700.0],
...: kstar1=[1, 1], kstar2=[1, 1],
...: metallicity=[0.002, 0.02])
...:
In [5]: print(binary_set)
kstar_1 kstar_2 mass_1 mass_2 porb ecc metallicity tphysf mass0_1 mass0_2 ... tacc_1 tacc_2 epoch_1 epoch_2 tms_1 tms_2 bhspin_1 bhspin_2 tphys binfrac
0 1.0 1.0 85.543645 84.99784 446.795757 0.448872 0.002 13700.0 85.543645 84.99784 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0
1 1.0 1.0 11.171469 6.67305 170.758343 0.370000 0.020 13700.0 11.171469 6.67305 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0
[2 rows x 38 columns]
In [6]: import numpy as np
In [7]: np.random.seed(5)
In [8]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=binary_set, BSEDict=BSEDict)
As before, bpp, bcm, and initC are returned as pandas DataFrames which assign an index to each binary system we evolve. We can access each binary as follows:
In [9]: print(bpp.loc[0])
tphys mass_1 mass_2 kstar_1 kstar_2 sep porb ecc RRLO_1 ... bacc_1 bacc_2 tacc_1 tacc_2 epoch_1 epoch_2 bhspin_1 bhspin_2 bin_num
0 0.000000 85.543645 84.997840 1 1 1363.435508 446.795757 0.448872 0.038788 ... 0.0 0.0 0.0 0.0 0.000000 0.000000 0.0 0.0 0
0 3.717075 72.720332 72.376321 2 1 1602.531512 617.238959 0.448872 0.107527 ... 0.0 0.0 0.0 0.0 -0.130492 -0.129941 0.0 0.0 0
0 3.718373 72.589218 72.377845 2 1 883.827396 252.923207 0.000000 1.000663 ... 0.0 0.0 0.0 0.0 -0.130492 -0.129911 0.0 0.0 0
0 3.718911 72.504133 72.396628 2 1 883.794364 252.966882 0.000000 2.522349 ... 0.0 0.0 0.0 0.0 -0.130492 -0.129306 0.0 0.0 0
0 3.718911 72.504133 72.396628 2 1 883.794364 252.966882 0.000000 2.522349 ... 0.0 0.0 0.0 0.0 -0.130492 -0.129306 0.0 0.0 0
0 3.718911 114.941973 72.396628 2 15 0.000000 0.000000 0.000000 0.990000 ... 0.0 0.0 0.0 0.0 -0.130492 -0.129306 0.0 0.0 0
0 3.719677 114.827105 0.000000 4 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 0.335591 -0.129303 0.0 0.0 0
0 4.054773 64.562614 0.000000 5 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 0.335591 -0.129303 0.0 0.0 0
0 4.069950 62.286075 0.000000 5 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 0.335591 -0.129303 0.0 0.0 0
0 4.069950 44.500000 0.000000 14 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 4.069950 -0.129303 0.0 0.0 0
0 13700.000000 44.500000 0.000000 14 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 4.069950 -0.129303 0.0 0.0 0
[11 rows x 44 columns]
In [10]: print(bcm.loc[0])
tphys kstar_1 mass0_1 mass_1 lum_1 rad_1 teff_1 massc_1 radc_1 ... sep ecc B_1 B_2 SN_1 SN_2 bin_state merger_type bin_num
0 0.0 1 85.543645 85.543645 9.416137e+05 11.060285 54306.854457 0.0 0.000000 ... 1363.435508 0.448872 0.0 0.0 0 0 0 -001 0
0 13700.0 14 114.941973 44.500000 1.000000e-10 0.000189 1334.770738 44.5 0.000189 ... 0.000000 -1.000000 0.0 0.0 6 0 1 0201 0
[2 rows x 39 columns]
In [11]: print(initC.loc[0])
kstar_1 1.000000
kstar_2 1.000000
mass_1 85.543645
mass_2 84.997840
porb 446.795757
...
fprimc_11 0.095238
fprimc_12 0.095238
fprimc_13 0.095238
fprimc_14 0.095238
fprimc_15 0.095238
Name: 0, Length: 138, dtype: float64
In [12]: print(bpp.loc[1])
tphys mass_1 mass_2 kstar_1 kstar_2 sep porb ecc RRLO_1 ... bacc_1 bacc_2 tacc_1 tacc_2 epoch_1 epoch_2 bhspin_1 bhspin_2 bin_num
1 0.000000 11.171469 6.673050 1 1 338.356712 170.758343 0.370000 0.049210 ... 0.0 0.0 0.0 0.0 0.000000 0.000000 0.0 0.0 1
1 19.426981 10.768477 6.664659 2 1 346.339604 178.911246 0.369999 0.115038 ... 0.0 0.0 0.0 0.0 -0.967443 -0.029114 0.0 0.0 1
1 19.461132 10.766344 6.664703 2 1 218.216976 89.483551 0.000000 1.000302 ... 0.0 0.0 0.0 0.0 -0.974685 -0.028824 0.0 0.0 1
1 19.474363 10.651743 6.778363 2 1 215.254261 87.669752 0.000000 2.345282 ... 0.0 0.0 0.0 0.0 -1.093884 1.004577 0.0 0.0 1
1 19.474363 10.651743 6.778363 2 1 215.254261 87.669752 0.000000 2.345282 ... 0.0 0.0 0.0 0.0 -1.093884 1.004577 0.0 0.0 1
1 19.474363 9.193860 6.778363 2 15 0.000000 0.000000 0.000000 0.990000 ... 0.0 0.0 0.0 0.0 -1.093884 1.004577 0.0 0.0 1
1 19.476609 9.193529 0.000000 3 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 -1.093884 1.004627 0.0 0.0 1
1 19.483502 9.190876 0.000000 4 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 -1.093884 1.004627 0.0 0.0 1
1 21.844018 8.282958 0.000000 5 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 -1.093884 1.004627 0.0 0.0 1
1 21.944216 7.152269 0.000000 5 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 -1.093884 1.004627 0.0 0.0 1
1 21.944216 1.277584 0.000000 13 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 21.944216 1.004627 0.0 0.0 1
1 13700.000000 1.277584 0.000000 13 15 0.000000 0.000000 -1.000000 0.000100 ... 0.0 0.0 0.0 0.0 21.944216 1.004627 0.0 0.0 1
[12 rows x 44 columns]
The plotting function can also take in multiple binaries. Let’s plot both the GW150914-like progenitor evolution and the GW170817-like progenitor evolutions. For the GW170817-like progenitor, we expect most of the evolution to take place in the first ~60 Myr.
In [13]: fig = evolve_and_plot(binary_set, t_min=None, t_max=[6.0, 60.0], BSEDict=BSEDict, sys_obs={})
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[13], line 1
----> 1 fig = evolve_and_plot(binary_set, t_min=None, t_max=[6.0, 60.0], BSEDict=BSEDict, sys_obs={})
NameError: name 'evolve_and_plot' is not defined