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, SF_start=13700.0,
   ...:                                  SF_duration=0.0, met=0.02, size=10, keep_singles=True)
   ...: 

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     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        0  0.540947  0.540947  0.047108  0.498024  3827.524280  0.000000  0.000000  ...    41.231595  0.257915  0.0  0.0     0     0          0         -001        0
0  13700.0        0  0.540947  0.540947  0.050400  0.510504  3844.833968  0.000000  0.000000  ...    41.231449  0.257913  0.0  0.0     0     0          0         -001        0
1      0.0        1  1.720935  1.720935  8.286040  1.527310  7959.627646  0.000000  0.000000  ...   277.005967  0.255143  0.0  0.0     0     0          0         -001        1
1  13700.0       10  0.438346  0.438346  0.000020  0.015245  3148.791969  0.438346  0.015245  ...     8.007995  0.000000  0.0  0.0     0     0          0         -001        1
2      0.0        1  0.850941  0.850941  0.310673  0.764895  4949.307941  0.000000  0.000000  ...  2750.334923  0.278934  0.0  0.0     0     0          0         -001        2
2  13700.0        1  0.850941  0.850941  0.582381  0.909136  5311.985496  0.000000  0.000000  ...  2750.334923  0.278934  0.0  0.0     0     0          0         -001        2
3      0.0        0  0.345433  0.345433  0.016927  0.333891  3619.172359  0.000000  0.000000  ...     5.461096  0.525869  0.0  0.0     0     0          0         -001        3
3  13700.0        0  0.345433  0.345433  0.017194  0.336799  3617.682879  0.000000  0.000000  ...     4.886211  0.459572  0.0  0.0     0     0          0         -001        3
4      0.0        0  0.205493  0.205493  0.005955  0.234964  3322.627172  0.000000  0.000000  ...     4.523477  0.022692  0.0  0.0     0     0          0         -001        4
4  13700.0        0  0.205493  0.205493  0.005985  0.235674  3321.889747  0.000000  0.000000  ...     4.521528  0.022669  0.0  0.0     0     0          0         -001        4

[10 rows x 39 columns]

In [8]: print(bpp)
           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  0.540947  0.330351        0        0   41.231595   32.872586  0.257915  0.038550  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0        0
0   13700.000000  0.540947  0.330351        0        0   41.231449   32.872411  0.257913  0.039516  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0        0
1       0.000000  1.720935  0.648362        1        0  277.005967  347.133210  0.255143  0.015912  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0        1
1    1825.092426  1.720935  0.648362        2        0  277.005966  347.133209  0.255143  0.032845  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0        1
1    1850.330914  1.720776  0.648362        3        0  277.024453  347.179571  0.255143  0.045878  ...     0.0     0.0     0.0     0.0 -0.507675  0.000448       0.0       0.0        1
..           ...       ...       ...      ...      ...         ...         ...       ...       ...  ...     ...     ...     ...     ...       ...       ...       ...       ...      ...
37  13700.000000  0.135418  0.000000        0       15    0.000000    0.000000 -1.000000  0.000100  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0       37
38      0.000000  0.265231  0.000000        0       15    0.000000    0.000000 -1.000000  0.000100  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0       38
38  13700.000000  0.265231  0.000000        0       15    0.000000    0.000000 -1.000000  0.000100  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0       38
39      0.000000  0.173066  0.000000        0       15    0.000000    0.000000 -1.000000  0.000100  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0       39
39  13700.000000  0.173066  0.000000        0       15    0.000000    0.000000 -1.000000  0.000100  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0       39

[113 rows x 44 columns]