107
107
else :
108
108
INITIAL_BINARY_TABLE_SAVE_COLUMNS = INITIAL_CONDITIONS_PASS_COLUMNS .copy ()
109
109
110
- for col in ['natal_kick_array' , 'qcrit_array' , 'fprimc_array' ]:
110
+ for col in ['natal_kick_array' , 'qcrit_array' , 'fprimc_array' , 'alpha1' , 'acc_lim' ]:
111
111
INITIAL_BINARY_TABLE_SAVE_COLUMNS .remove (col )
112
112
113
113
NATAL_KICK_COLUMNS = ['natal_kick' ,
123
123
124
124
QCRIT_COLUMNS = ['qcrit_{0}' .format (kstar ) for kstar in range (0 , 16 )]
125
125
FPRIMC_COLUMNS = ['fprimc_{0}' .format (kstar ) for kstar in range (0 , 16 )]
126
+ ALPHA_COLUMNS = ['alpha1_{0}' .format (star ) for star in range (0 , 2 )]
127
+ ACCLIM_COLUMNS = ['acc_lim_{0}' .format (star ) for star in range (0 , 2 )]
126
128
127
129
INITIAL_BINARY_TABLE_SAVE_COLUMNS .extend (FLATTENED_NATAL_KICK_COLUMNS )
128
130
INITIAL_BINARY_TABLE_SAVE_COLUMNS .extend (QCRIT_COLUMNS )
129
131
INITIAL_BINARY_TABLE_SAVE_COLUMNS .extend (FPRIMC_COLUMNS )
132
+ INITIAL_BINARY_TABLE_SAVE_COLUMNS .extend (ALPHA_COLUMNS )
133
+ INITIAL_BINARY_TABLE_SAVE_COLUMNS .extend (ACCLIM_COLUMNS )
130
134
131
135
# BSE doesn't need the binary fraction, so just add to columns for saving
132
136
INITIAL_BINARY_TABLE_SAVE_COLUMNS .insert (7 , 'binfrac' )
@@ -242,11 +246,11 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
242
246
# in order to verify that the values in the table
243
247
# are valid
244
248
utils .error_check (BSEDict , SSEDict )
245
-
249
+
246
250
# check the initial conditions of the system and warn user if
247
251
# anything is weird about them, such as the star starts
248
252
# in Roche Lobe overflow
249
- utils .check_initial_conditions (initialbinarytable , SSEDict )
253
+ utils .check_initial_conditions (initialbinarytable )
250
254
251
255
# assign some columns based on keyword arguments but that
252
256
# can be overwritten by the params or BSEDict
@@ -257,15 +261,24 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
257
261
initialbinarytable = initialbinarytable .assign (randomseed = kwargs .pop ('randomseed' , seed ))
258
262
if 'bin_num' not in initialbinarytable .keys ():
259
263
initialbinarytable = initialbinarytable .assign (bin_num = np .arange (idx , idx + len (initialbinarytable )))
260
-
261
- for k , v in SSEDict .items ():
262
- if k in initialbinarytable .keys ():
263
- warnings .warn ("The value for {0} in initial binary table is being "
264
- "overwritten by the value of {0} from either the params "
265
- "file or the SSEDict." .format (k ))
266
- # assigning values this way work for most of the parameters.
267
- kwargs1 = {k : v }
268
- initialbinarytable = initialbinarytable .assign (** kwargs1 )
264
+
265
+ if SSEDict :
266
+ if SSEDict ['stellar_engine' ] == 'metisse' :
267
+ for k , v in SSEDict .items ():
268
+ if k in initialbinarytable .keys ():
269
+ warnings .warn ("The value for {0} in initial binary table is being "
270
+ "overwritten by the value of {0} from either the params "
271
+ "file or the SSEDict." .format (k ))
272
+ # assigning values this way work for most of the parameters.:
273
+
274
+ kwargs1 = {k : v }
275
+ initialbinarytable = initialbinarytable .assign (** kwargs1 )
276
+ elif SSEDict ['stellar_engine' ] == 'sse' :
277
+ kwargs1 = {'stellar_engine' : 'sse' }
278
+ initialbinarytable = initialbinarytable .assign (** kwargs1 )
279
+ for col in ['path_to_tracks' , 'path_to_he_tracks' ]:
280
+ kwargs1 = {col : '' }
281
+ initialbinarytable = initialbinarytable .assign (** kwargs1 )
269
282
270
283
for k , v in BSEDict .items ():
271
284
if k in initialbinarytable .keys ():
@@ -299,6 +312,22 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
299
312
index = initialbinarytable .index ,
300
313
name = 'fprimc_{0}' .format (kstar ))
301
314
initialbinarytable .loc [:, 'fprimc_{0}' .format (kstar )] = columns_values
315
+ elif k == 'alpha1' :
316
+ columns_values = [BSEDict ['alpha1' ]] * len (initialbinarytable )
317
+ initialbinarytable = initialbinarytable .assign (alpha1 = columns_values )
318
+ for kstar in range (0 , 2 ):
319
+ columns_values = pd .Series ([BSEDict ['alpha1' ][kstar ]] * len (initialbinarytable ),
320
+ index = initialbinarytable .index ,
321
+ name = 'alpha1_{0}' .format (kstar ))
322
+ initialbinarytable .loc [:, 'alpha1_{0}' .format (kstar )] = columns_values
323
+ elif k == 'acc_lim' :
324
+ columns_values = [BSEDict ['acc_lim' ]] * len (initialbinarytable )
325
+ initialbinarytable = initialbinarytable .assign (acc_lim = columns_values )
326
+ for kstar in range (0 ,2 ):
327
+ columns_values = pd .Series ([BSEDict ['acc_lim' ][kstar ]] * len (initialbinarytable ),
328
+ index = initialbinarytable .index ,
329
+ name = 'acc_lim_{0}' .format (kstar ))
330
+ initialbinarytable .loc [:, 'acc_lim_{0}' .format (kstar )] = columns_values
302
331
else :
303
332
# assigning values this way work for most of the parameters.
304
333
kwargs1 = {k : v }
@@ -309,14 +338,19 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
309
338
# and either a dictionary or an inifile was not provided
310
339
# then we need to raise an ValueError and tell the user to provide
311
340
# either a dictionary or an inifile or add more columns
312
- if not BSEDict :
341
+ if BSEDict and SSEDict is None :
313
342
if ((not set (INITIAL_BINARY_TABLE_SAVE_COLUMNS ).issubset (initialbinarytable .columns )) and
314
343
(not set (INITIAL_CONDITIONS_PASS_COLUMNS ).issubset (initialbinarytable .columns ))):
315
344
raise ValueError ("You are passing BSE parameters as columns in the "
316
345
"initial binary table but not all BSE parameters are defined. "
317
346
"Please pass a BSEDict or a params file or make sure "
318
347
"you have all BSE parameters as columns {0} or {1}." .format (
319
348
INITIAL_BINARY_TABLE_SAVE_COLUMNS , INITIAL_CONDITIONS_PASS_COLUMNS ))
349
+
350
+ if (BSEDict and not SSEDict ) or (SSEDict and not BSEDict ):
351
+ raise ValueError ("If you are passing BSE parameters as columns in the "
352
+ "initial binary table you must also pass SSE parameters "
353
+ "in the initial binary table." )
320
354
321
355
# If you did not supply the natal kick or qcrit_array or fprimc_array in the BSEdict then we construct
322
356
# it from the initial conditions table
@@ -333,6 +367,13 @@ def evolve(cls, initialbinarytable, pool=None, **kwargs):
333
367
if (pd .Series (FPRIMC_COLUMNS ).isin (initialbinarytable .keys ()).all ()) and ('fprimc_array' not in BSEDict ):
334
368
initialbinarytable = initialbinarytable .assign (fprimc_array = initialbinarytable [FPRIMC_COLUMNS ].values .tolist ())
335
369
370
+ if (pd .Series (ALPHA_COLUMNS ).isin (initialbinarytable .keys ()).all ()) and ('alpha1' not in BSEDict ):
371
+ initialbinarytable = initialbinarytable .assign (alpha1 = initialbinarytable [ALPHA_COLUMNS ].values .tolist ())
372
+
373
+ if (pd .Series (ACCLIM_COLUMNS ).isin (initialbinarytable .keys ()).all ()) and ('acc_lim' not in BSEDict ):
374
+ initialbinarytable = initialbinarytable .assign (acc_lim = initialbinarytable [ACCLIM_COLUMNS ].values .tolist ())
375
+
376
+
336
377
# need to ensure that the order of parameters that we pass to BSE
337
378
# is correct
338
379
initial_conditions = initialbinarytable [INITIAL_CONDITIONS_PASS_COLUMNS ].to_dict ('records' )
0 commit comments