Evolving a fixed grid of binaries

Sometimes it is helpful to run a fixed grid of initial binaries to explore how changing a single parameter affects the evolved binary. Let’s start by importing the necessary modules:

In [1]: from cosmic.sample.initialbinarytable import InitialBinaryTable

In [2]: from cosmic.evolve import Evolve

Here we evolve the same system that produces a GW150914-like binary, but run over several initial orbital periods spaced evenly in log space.

In [3]: n_grid = 10

In [4]: binary_grid = InitialBinaryTable.InitialBinaries(m1=np.ones(n_grid)*100.0,
   ...:                                                  m2=np.ones(n_grid)*85.0,
   ...:                                                  porb=np.logspace(3,5,n_grid),
   ...:                                                  ecc=np.ones(n_grid)*0.65,
   ...:                                                  tphysf=np.ones(n_grid)*13700.0,
   ...:                                                  kstar1=np.ones(n_grid),
   ...:                                                  kstar2=np.ones(n_grid),
   ...:                                                  metallicity=np.ones(n_grid)*0.005)
   ...: 

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.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0,
   ...:            'wd_mass_lim': 1}
   ...: 

In [6]: print(binary_grid)
   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   100.0    85.0    1000.000000  0.65        0.005  13700.0    100.0     85.0  ...     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   100.0    85.0    1668.100537  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
2      1.0      1.0   100.0    85.0    2782.559402  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
3      1.0      1.0   100.0    85.0    4641.588834  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
4      1.0      1.0   100.0    85.0    7742.636827  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
5      1.0      1.0   100.0    85.0   12915.496650  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
6      1.0      1.0   100.0    85.0   21544.346900  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
7      1.0      1.0   100.0    85.0   35938.136638  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
8      1.0      1.0   100.0    85.0   59948.425032  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0
9      1.0      1.0   100.0    85.0  100000.000000  0.65        0.005  13700.0    100.0     85.0  ...     0.0     0.0      0.0      0.0    0.0    0.0       0.0       0.0    0.0      1.0

[10 rows x 38 columns]

In [7]: bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=binary_grid, BSEDict=BSEDict)

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  100.000000  85.000000        1        1    2397.042879  1.000000e+03  0.650000  4.214342e-02  ...     0.0     0.0     0.0     0.0  0.000000  0.000000       0.0       0.0        0
0       3.561836   74.433283  67.900444        2        1    3115.630394  1.689418e+03  0.650000  1.241381e-01  ...     0.0     0.0     0.0     0.0 -0.192142 -0.163778       0.0       0.0        0
0       3.563725   74.195874  67.901480        2        1    1092.094610  3.508888e+02  0.000000  1.001714e+00  ...     0.0     0.0     0.0     0.0 -0.192142 -0.163756       0.0       0.0        0
0       3.564540   74.067416  67.928303        2        1    1092.078530  3.510066e+02  0.000000  2.469715e+00  ...     0.0     0.0     0.0     0.0 -0.192142 -0.162855       0.0       0.0        0
0       3.564540   74.067416  67.928303        2        1    1092.078530  3.510066e+02  0.000000  2.469715e+00  ...     0.0     0.0     0.0     0.0 -0.192142 -0.162855       0.0       0.0        0
..           ...         ...        ...      ...      ...            ...           ...       ...           ...  ...     ...     ...     ...     ...       ...       ...       ...       ...      ...
9       3.930319   28.153730  35.520384       14        4  146429.360489  8.138286e+05  0.644795  6.393219e-09  ...     0.0     0.0     0.0     0.0  3.930319 -0.176003       0.0       0.0        9
9       3.960762   28.159126  31.484483       14        7  156283.133906  9.271679e+05  0.644677  5.821999e-09  ...     0.0     0.0     0.0     0.0  3.930319  3.758602       0.0       0.0        9
9       4.100892   28.159126  24.732495       14        7  176246.781774  1.179127e+06  0.644677  5.821999e-09  ...     0.0     0.0     0.0     0.0  3.930319  3.722109       0.0       0.0        9
9       4.100892   28.159126  24.232495       14       14  177493.602610  1.197334e+06  0.643565  4.814477e-09  ...     0.0     0.0     0.0     0.0  3.930319  4.100892       0.0       0.0        9
9   13700.000000   28.159126  24.232495       14       14  177454.065764  1.196934e+06  0.643565  4.815550e-09  ...     0.0     0.0     0.0     0.0  3.930319  4.100892       0.0       0.0        9

[131 rows x 44 columns]

In [9]: print(bcm)
     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  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...    2397.042879  0.650000  0.0  0.0     0     0          0         -001        0
0  13700.0       15  116.049841    0.000000  2.545182e+06   2.673427  141633.234395  65.316998  2.654538  ...       0.000000 -1.000000  0.0  0.0     7     0          1         0201        0
1      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...    3371.506109  0.650000  0.0  0.0     0     0          0         -001        1
1  13700.0       14   48.685555   44.500000  1.000000e-10   0.000189    1334.770738  44.500000  0.000189  ...       0.000000 -1.000000  0.0  0.0     6     0          1         0201        1
2      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...    4742.115190  0.650000  0.0  0.0     0     0          0         -001        2
2  13700.0       15   23.252957    0.000000  1.000000e-10   0.000097    1866.081894  22.767323  0.000097  ...       0.000000 -1.000000  0.0  0.0     1     1          1         1414        2
3      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...    6669.914200  0.650000  0.0  0.0     0     0          0         -001        3
3  13700.0       14   27.066154   26.858170  1.000000e-10   0.000114    1718.100149  26.858170  0.000114  ...    3616.631848  0.009059  0.0  0.0     1     1          0         -001        3
4      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...    9381.416025  0.650000  0.0  0.0     0     0          0         -001        4
4  13700.0       14   24.672076   24.172691  1.000000e-10   0.000102    1811.023906  24.172691  0.000102  ...      77.874086  0.021385  0.0  0.0     1     1          0         -001        4
5      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...   13195.217208  0.650000  0.0  0.0     0     0          0         -001        5
5  13700.0       14   29.517261   29.070919  1.000000e-10   0.000123    1651.419089  29.070919  0.000123  ...   25515.940683  0.461928  0.0  0.0     1     1          0         -001        5
6      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...   18559.432469  0.650000  0.0  0.0     0     0          0         -001        6
6  13700.0       14   28.990549   28.531296  1.000000e-10   0.000121    1666.962892  28.531296  0.000121  ...   53306.965811  0.604200  0.0  0.0     1     1          0         -001        6
7      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...   26104.347365  0.650000  0.0  0.0     0     0          0         -001        7
7  13700.0       14   28.809440   28.333255  1.000000e-10   0.000120    1672.778537  28.333255  0.000120  ...   83614.059233  0.631963  0.0  0.0     1     1          0         -001        7
8      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...   36716.475706  0.650000  0.0  0.0     0     0          0         -001        8
8  13700.0       14   28.708663   28.219764  1.000000e-10   0.000120    1676.138863  28.219764  0.000120  ...  123548.033599  0.640129  0.0  0.0     1     1          0         -001        8
9      0.0        1  100.000000  100.000000  1.240906e+06  13.897608   51907.996879   0.000000  0.000000  ...   51642.723315  0.650000  0.0  0.0     0     0          0         -001        9
9  13700.0       14   28.653730   28.159126  1.000000e-10   0.000119    1677.942595  28.159126  0.000119  ...  177454.065764  0.643565  0.0  0.0     1     1          0         -001        9

[20 rows x 39 columns]