COMPASPopulation#

class cogsworth.interop.compas.pop.COMPASPopulation(n_binaries, config_file=None, logfile_definitions=None, output_directory='./COMPAS_Output', hide_COMPAS_output=True, **kwargs)[source]#

Bases: Population

A Population class which uses COMPAS to perform binary stellar evolution instead of COSMIC

This class extends the generic Population class to use COMPAS as the binary stellar evolution engine. It requires a COMPAS installation to be available.

Parameters:
n_binariesint

The number of binaries to simulate

config_filestr, optional

The path to the COMPAS configuration file to use. If None, a default config file included with cogsworth is used.

logfile_definitionsstr, optional

The path to the COMPAS logfile definitions file to use. If None, a default logfile definitions file included with cogsworth is used. TODO: list which columns are necessary

output_directorystr, optional

The directory to output the COMPAS results to. If the directory already exists, a suffix _1, _2 etc. will be appended to create a new directory. By default, “./COMPAS_Output” is used.

hide_COMPAS_outputbool, optional

Whether to hide the COMPAS output in the terminal when running the simulations. By default, True.

**kwargsdict

Additional keyword arguments to pass to the Population class constructor

Methods Summary

from_COMPAS_output(compas_output_file[, ...])

Create a COMPASPopulation from an existing COMPAS output file

initial_binaries_to_gridfile(grid_filename)

Write the initial binaries to a COMPAS grid file

perform_stellar_evolution()

Perform the (binary) stellar evolution of the sampled binaries

to_Population(**kwargs)

Convert this COMPASPopulation to a generic Population object that uses COSMIC

Methods Documentation

classmethod from_COMPAS_output(compas_output_file, lookback_times=None, **kwargs)[source]#

Create a COMPASPopulation from an existing COMPAS output file

This class method creates a COMPASPopulation object from an existing COMPAS output file which has already been generated with COMPAS. The initial binaries, BPP and kick information are read from the output file.

Parameters:
compas_output_filestr

The path to the COMPAS output file (HDF5 format)

lookback_timesarray-like, optional

An array of lookback times (in Myr) to use for each binary when reading the initial conditions. If None, the maximum evolution times stored in the COMPAS output file are used (found in the PO_Max_Evolution_Time column). If that column is not present, a warning is issued and a default of 13.7 Gyr is assumed for all systems.

**kwargsdict

Additional keyword arguments to pass to the COMPASPopulation constructor

Returns:
pop~cogsworth.interop.compas.COMPASPopulation

The COMPASPopulation object created from the COMPAS output file

initial_binaries_to_gridfile(grid_filename)[source]#

Write the initial binaries to a COMPAS grid file

Parameters:
grid_filenamestr

The path to the grid file to write the initial binaries to

perform_stellar_evolution()[source]#

Perform the (binary) stellar evolution of the sampled binaries

to_Population(**kwargs)[source]#

Convert this COMPASPopulation to a generic Population object that uses COSMIC