Evolving a Monte-Carlo sampled population¶
Once an initial binary population is sampled, it can be evolved using the Evolve
class just as we’ve done so far.
You can read more about sampling initial binary populations in the Sampling initial populations page.
Note that the same process used other examples applies here as well: the BSEDict
must be supplied,
if the flags in the dictionary change from their defaults.
First, let’s import the necessary modules from COSMIC:
In [1]: from cosmic.sample.initialbinarytable import InitialBinaryTable
In [2]: from cosmic.evolve import Evolve
Now let’s use the independent sampler to generate an initial binary population. You can learn more about the independent sampler in the Independent distributions page.
In [3]: final_kstars = range(16)
In [4]: InitialBinaries, mass_singles, mass_binaries, n_singles, n_binaries = \
...: InitialBinaryTable.sampler('independent', final_kstars, final_kstars,
...: binfrac_model=0.5, primary_model='kroupa01',
...: ecc_model='sana12', porb_model='sana12',
...: qmin=-1, m2_min=0.08, SF_start=13700.0,
...: SF_duration=0.0, met=0.02, size=10)
...:
And finally, we can evolve the initial binary population using the Evolve class as we’ve done in the previous guides:
In [5]: 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.019, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim' : 1}
In [6]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=InitialBinaries,
...: BSEDict=BSEDict)
...:
In [7]: print(bcm.iloc[:10])
tphys kstar_1 mass0_1 mass_1 ... SN_2 bin_state merger_type bin_num
0 0.0 0 0.398938 0.398938 ... 0 0 -001 0
0 13700.0 0 0.398938 0.398938 ... 0 0 -001 0
1 0.0 1 0.809565 0.809565 ... 0 0 -001 1
1 13700.0 1 0.809565 0.809565 ... 0 0 -001 1
2 0.0 1 1.111365 1.111365 ... 0 0 -001 2
2 13700.0 11 0.517294 0.517294 ... 0 1 0300 2
3 0.0 0 0.319987 0.319987 ... 0 0 -001 3
3 13700.0 0 0.319987 0.319987 ... 0 0 -001 3
4 0.0 0 0.180052 0.180052 ... 0 0 -001 4
4 13700.0 0 0.180052 0.180052 ... 0 0 -001 4
[10 rows x 39 columns]
In [8]: print(bpp)
tphys mass_1 mass_2 ... bhspin_1 bhspin_2 bin_num
0 0.000000 0.398938 0.179851 ... 0.0 0.0 0
0 13700.000000 0.398938 0.179851 ... 0.0 0.0 0
1 0.000000 0.809565 0.114267 ... 0.0 0.0 1
1 13700.000000 0.809565 0.114267 ... 0.0 0.0 1
2 0.000000 1.111365 0.278573 ... 0.0 0.0 2
2 7502.118529 1.111365 0.278573 ... 0.0 0.0 2
2 7897.255209 1.110902 0.278574 ... 0.0 0.0 2
2 8451.793389 1.105732 0.278653 ... 0.0 0.0 2
2 8451.793389 1.105732 0.278653 ... 0.0 0.0 2
2 8451.793389 0.940190 0.278653 ... 0.0 0.0 2
2 8525.650205 0.678319 0.000000 ... 0.0 0.0 2
2 8660.697268 0.642500 0.000000 ... 0.0 0.0 2
2 8665.485140 0.527199 0.000000 ... 0.0 0.0 2
2 8665.651007 0.517294 0.000000 ... 0.0 0.0 2
2 13700.000000 0.517294 0.000000 ... 0.0 0.0 2
3 0.000000 0.319987 0.122823 ... 0.0 0.0 3
3 13700.000000 0.319987 0.122823 ... 0.0 0.0 3
4 0.000000 0.180052 0.089006 ... 0.0 0.0 4
4 13700.000000 0.180052 0.089006 ... 0.0 0.0 4
5 0.000000 1.178928 0.192730 ... 0.0 0.0 5
5 6058.825637 1.178928 0.192730 ... 0.0 0.0 5
5 6377.921489 1.178480 0.192735 ... 0.0 0.0 5
5 6386.328706 1.178467 0.192735 ... 0.0 0.0 5
5 6386.328706 1.178467 0.192735 ... 0.0 0.0 5
5 6386.328706 1.332784 0.192735 ... 0.0 0.0 5
5 6887.614348 1.193327 0.000000 ... 0.0 0.0 5
5 7019.559169 1.160223 0.000000 ... 0.0 0.0 5
5 7023.619603 1.114641 0.000000 ... 0.0 0.0 5
5 7024.478019 0.548605 0.000000 ... 0.0 0.0 5
5 13700.000000 0.548605 0.000000 ... 0.0 0.0 5
6 0.000000 0.194429 0.166231 ... 0.0 0.0 6
6 13700.000000 0.194429 0.166231 ... 0.0 0.0 6
7 0.000000 4.069168 0.575307 ... 0.0 0.0 7
7 145.457767 4.067198 0.575308 ... 0.0 0.0 7
7 145.457767 0.000000 4.642507 ... 0.0 0.0 7
7 145.457767 0.000000 4.642507 ... 0.0 0.0 7
7 270.050456 0.000000 4.637515 ... 0.0 0.0 7
7 270.590674 0.000000 4.637195 ... 0.0 0.0 7
7 270.943199 0.000000 4.635970 ... 0.0 0.0 7
7 290.655946 0.000000 4.579703 ... 0.0 0.0 7
7 291.644129 0.000000 4.541570 ... 0.0 0.0 7
7 292.257015 0.000000 0.943807 ... 0.0 0.0 7
7 13700.000000 0.000000 0.943807 ... 0.0 0.0 7
8 0.000000 0.487657 0.282418 ... 0.0 0.0 8
8 13700.000000 0.487657 0.282418 ... 0.0 0.0 8
9 0.000000 0.269313 0.237081 ... 0.0 0.0 9
9 13700.000000 0.269313 0.237081 ... 0.0 0.0 9
[47 rows x 44 columns]