independent

class cosmic.sample.sampler.independent.Sample

Bases: object

binary_select(self, primary_mass, binfrac_model=0.5)

Select which primary masses will have a companion using either a binary fraction specified by a float or a primary-mass dependent binary fraction following van Haaften et al.(2009) in appdx

Parameters

primary_mass : array

Mass that determines the binary fraction

binfrac_model : str or float

vanHaaften - primary mass dependent and ONLY VALID

up to 100 Msun

float - fraction of binaries; 0.5 means 2 in 3 stars are a binary pair while 1 means every star is in a binary pair

Returns

primary_mass[binaryIdx] : array

primary masses that will have a binary companion

primary_mass[singleIdx] : array

primary masses that will be single stars

binary_fraction[binaryIdx] : array

system-specific probability of being in a binary

sample_SFH(self, SF_start=13700.0, SF_duration=0.0, met=0.02, size=None)

Sample an evolution time for each binary based on a user-specified time at the start of star formation and the duration of star formation. The default is a burst of star formation 13,700 Myr in the past.

Parameters

SF_start : float

Time in the past when star formation initiates in Myr

SF_duration : float

Duration of constant star formation beginning from SF_Start in Myr

met : float

metallicity of the population [Z_sun = 0.02] Default: 0.02

size : int, optional

number of evolution times to sample NOTE: this is set in cosmic-pop call as Nstep

Returns

tphys : array

array of evolution times of size=size

metallicity : array

array of metallicities

sample_ecc(self, ecc_model='sana12', size=None)

Sample the eccentricity according to a user specified model

Parameters

ecc_model : string

‘thermal’ samples from a thermal eccentricity distribution following Heggie (1975) ‘uniform’ samples from a uniform eccentricity distribution ‘sana12’ samples from the eccentricity distribution from Sana+2012 <https://ui.adsabs.harvard.edu/abs/2012Sci…337..444S/abstract>_ ‘circular’ assumes zero eccentricity for all systems DEFAULT = ‘sana12’

size : int, optional

number of eccentricities to sample NOTE: this is set in cosmic-pop call as Nstep

Returns

ecc : array

array of sampled eccentricities with size=size

sample_porb(self, mass1, mass2, ecc, porb_model='sana12', size=None)

Sample the orbital period according to the user-specified model

Parameters

mass1 : array

primary masses

mass2 : array

secondary masses

ecc : array

eccentricity

model : string

selects which model to sample orbital periods, choices include: log_uniform : semi-major axis flat in log space from RRLO < 0.5 up

to 1e5 Rsun according to Abt (1983)

and consistent with Dominik+2012,2013 and then converted to orbital period in days using Kepler III

sana12power law orbital period between 0.15 < log(P/day) < 5.5 following

Sana+2012 <https://ui.adsabs.harvard.edu/abs/2012Sci…337..444S/abstract>_

renzo19power law orbital period for m1 > 15Msun binaries from

Sana+2012 <https://ui.adsabs.harvard.edu/abs/2012Sci…337..444S/abstract>_ following the implementation of Renzo+2019 <https://ui.adsabs.harvard.edu/abs/2019A%26A…624A..66R/abstract>_ and flat in log otherwise

Returns

porb : array

orbital period with array size equalling array size of mass1 and mass2 in units of days

sample_primary(self, primary_model='kroupa01', size=None)

Sample the primary mass (always the most massive star) from a user-selected model

kroupa93 follows Kroupa (1993), normalization comes from Hurley 2002 between 0.08 and 150 Msun salpter55 follows Salpeter (1955) between 0.08 and 150 Msun kroupa01 follows Kroupa (2001) <https://arxiv.org/abs/astro-ph/0009005> between 0.08 and 100 Msun

Parameters

primary_model : str, optional

model for mass distribution; choose from:

kroupa93 follows Kroupa (1993), normalization comes from Hurley 2002 valid for masses between 0.1 and 100 Msun

salpter55 follows Salpeter (1955) valid for masses between 0.1 and 100 Msun

kroupa01 follows Kroupa (2001), normalization comes from Hurley 2002 valid for masses between 0.1 and 100 Msun

Default kroupa01

size : int, optional

number of initial primary masses to sample NOTE: this is set in cosmic-pop call as Nstep

Returns

a_0 : array

Sampled primary masses

sampled_mass : float

Total amount of mass sampled

sample_secondary(self, primary_mass)

Sample a secondary mass using draws from a uniform mass ratio distribution motivated by Mazeh et al. (1992) and Goldberg & Mazeh (1994)

NOTE: the lower lim is: 0.08 Msun while the higher lim is the primary mass

Parameters

primary_mass : array

sets the maximum secondary mass (for a maximum mass ratio of 1)

Returns

secondary_mass : array

sampled secondary masses with array size matching size of primary_mass

set_kstar(self, mass)

Initialize stellar types according to BSE classification kstar=1 if M>=0.7 Msun; kstar=0 if M<0.7 Msun

Parameters

mass : array

array of masses

Returns

kstar : array

array of initial stellar types

cosmic.sample.sampler.independent.get_independent_sampler(final_kstar1, final_kstar2, primary_model, ecc_model, porb_model, SF_start, SF_duration, binfrac_model, met, size, **kwargs)

Generates an initial binary sample according to user specified models

Parameters

final_kstar1 : int or list

Int or list of final kstar1

final_kstar2 : int or list

Int or list of final kstar2

primary_model : str

Model to sample primary mass; choices include: kroupa93, kroupa01, salpeter55

ecc_model : str

Model to sample eccentricity; choices include: thermal, uniform, sana12

porb_model : str

Model to sample orbital period; choices include: log_uniform, sana12

SF_start : float

Time in the past when star formation initiates in Myr

SF_duration : float

Duration of constant star formation beginning from SF_Start in Myr

binfrac_model : str or float

Model for binary fraction; choices include: vanHaaften or a fraction where 1.0 is 100% binaries

met : float

Sets the metallicity of the binary population where solar metallicity is 0.02

size : int

Size of the population to sample

Returns

InitialBinaryTable : pandas.DataFrame

DataFrame in the format of the InitialBinaryTable

mass_singles : float

Total mass in single stars needed to generate population

mass_binaries : float

Total mass in binaries needed to generate population

n_singles : int

Number of single stars needed to generate a population

n_binaries : int

Number of binaries needed to generate a population