evolve
- class cosmic.evolve.Evolve[source]¶
Bases:
objectinitialize Evolve
- classmethod evolve(initialbinarytable, pool=None, bpp_columns=None, bcm_columns=None, dt_mass_modifiers=[(40, 70, 0.3), (70, inf, 0.1)], **kwargs)[source]¶
After setting a number of initial conditions we evolve the system.
- Parameters:
- initialbinarytableDataFrame
Initial conditions of the binary
- poolMultiprocessing pool
Pool of workers to use to evolve systems in parallel
- bpp_columnslist, optional, default: None
Columns to save in the bpp table (key evolutionary stage table)
- bcm_columnslist, optional, default: None
Columns to save in the bcm table (detailed evolution table)
- dt_modifierslist of tuples, optional, default: [(40, 70, 0.3), (70, np.inf, 0.1)]
List of tuples specifying the mass ranges and corresponding modifiers for the timestep size. Our recommended default improves the numerical stability at higher masses. Each tuple should be of the form (m_low, m_high, mod) and will modify the default timestep by a factor of mod for systems with a primary mass in the range m_low <= mass_1 < m_high. For example, (40, 70, 0.3) would multiply the default timestep size by 0.3 for systems with primary mass between [40, 70) solar masses. We apply the modifier to the pts1, pts2, and pts3 parameters which control the timestep size in different evolutionary phases. These changes are logged in the initial conditions table so you can keep track of which systems had their timesteps modified. Avoid overlapping mass ranges for different modifiers as this will result in multiple modifiers being applied in the overlap region. NOTE: these modifiers are only applied to columns which aren’t present in the initialbinarytable that is passed in (i.e. they only modify values provided by a BSEDict or params.ini file)
- **kwargs:
There are three ways to tell evolve and thus the fortran what you want all the flags and other BSE specific parameters to be. If you pass both a dictionary of flags and/or a inifile and a table with the BSE parameters in the columns, the column values will be overwritten by what is in the dictionary or ini file.
NUMBER 1: PASS A DICTIONARY OF FLAGS
BSEDict
NUMBER 2: PASS A PANDAS DATA FRAME WITH PARAMS DEFINED AS COLUMNS
All you need is the initialbinarytable if the all the BSE parameters are defined as columns
NUMBER 3: PASS PATH TO A INI FILE WITH THE FLAGS DEFINED
params
You can also add a progress bar by setting: progress=True
- randomseedint, optional, default let numpy choose for you
If you would like the random seed that the underlying fortran code uses to be the same for all of the initial conditions you passed then you can send this keyword argument in. It is recommended to just let numpy choose a random number as the Fortran random seed and then this number will be returned as a column in the initial binary table so that you can reproduce the results.
- nprocint, optional, default: 1
number of CPUs to use to evolve systems in parallel
- idxint, optional, default: 0
initial index of the bcm/bpp arrays
- dtpfloat, optional: default: tphysf
timestep size in Myr for bcm output where tphysf is total evolution time in Myr
- n_per_blockint, optional, default: -1
number of systems to evolve in a block with _evolve_multi_system, to allow larger multiprocessing queues and reduced overhead. If less than 1 use _evolve_single_system
- Returns:
- output_bpp
pandas.DataFrame Table of key evolutionary stages for each binary
- output_bcm
pandas.DataFrame Table of detailed evolution for each binary
- initialbinarytableDataFrame
Initial conditions for each binary
- output_bpp
- cosmic.evolve.populate_tracks(track_list, is_he=False)[source]¶
Populate Fortran track data structures from a list of Python track dictionaries and pass them to the COSMIC Fortran backend.
- Parameters:
- track_listlist of dict
- Each dictionary must contain the following keys:
‘filename’ : str
‘initial_mass’ : float
‘initial_Y’ : float
‘initial_Z’ : float
‘Fe_div_H’ : float
‘alpha_div_Fe’ : float
‘v_div_vcrit’ : float
‘ntrack’ : int
‘neep’ : int
‘ncol’ : int
‘eep’ : array-like of shape (neep,)
‘tr’ : array-like of shape (ncol, ntrack)
‘cols’ : list of str of length ncol
- is_hebool, default=False
Indicates whether the tracks are helium-enriched.
- Returns:
- tuple of float
The minimum and maximum initial masses from the track list.
The function calls the Fortran subroutine _evolvebin.c_m_interface.set_tracks_from_python and populates the Fortran-side track arrays. The Python-side arrays are used only as temporary buffers for the call.
- cosmic.evolve.read_tracks_for_METISSE(path_to_tracks, IBT_Z, z_accuracy_limit, is_he)[source]¶
load in the metallicity, format, and eep files
- Parameters:
- path_to_tracksstr
Direct path to where all single star data and metallicty/format files are stored for hydrogen-rich stars
- IBT_Zfloat
Metallicity from the initialbinarytable
- z_accuracy_limitfloat
Tolerance for match in metallicity value
- is_hebool, default=False
Indicates whether the tracks are helium-enriched.
- Returns
- ——-
- m_minfloat
Minimum mass in the tracks that were loaded in
- m_maxfloat
Maximum mass in the tracks that were loaded in