get_independent_sampler

cosmic.sample.sampler.independent.get_independent_sampler(final_kstar1, final_kstar2, primary_model, ecc_model, porb_model, SF_start, SF_duration, binfrac_model, met, SSEDict=None, size=None, total_mass=inf, sampling_target='size', trim_extra_samples=False, q_power_law=0, pool=None, nproc=1, **kwargs)[source]

Generates an initial binary sample according to user specified models

Parameters:
final_kstar1int or list

Int or list of final kstar1

final_kstar2int or list

Int or list of final kstar2

primary_modelstr

Model to sample primary mass; choices include: kroupa93, kroupa01, salpeter55, custom if ‘custom’ is selected, must also pass arguemts: alphas : array

list of power law indices

mcutsarray

breaks in the power laws.

e.g. alphas=[-1.3,-2.3,-2.3],mcuts=[0.08,0.5,1.0,150.] reproduces standard Kroupa2001 IMF

ecc_modelstr

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

porb_modelstr or dict

Model to sample orbital period; choices include: log_uniform, sana12, renzo19, raghavan10, moe19, martinez26, martinez26_ecsn or a custom power law distribution defined with a dictionary with keys “min”, “max”, and “slope” (e.g. {“min”: 0.15, “max”: 0.55, “slope”: -0.55}) would reproduce the Sana+2012 distribution

qminfloat

kwarg which sets the minimum mass ratio for sampling the secondary where the mass ratio distribution is flat in q if q > 0, qmin sets the minimum mass ratio q = -1, this limits the minimum mass ratio to be set such that the pre-MS lifetime of the secondary is not longer than the full lifetime of the primary if it were to evolve as a single star. Cannot be used in conjunction with m2_min

m_maxfloat

kwarg which sets the maximum primary and secondary mass for sampling NOTE: this value changes the range of the IMF and should not be used

as a means of selecting certain kstar types!

m1_minfloat

kwarg which sets the minimum primary mass for sampling NOTE: this value changes the range of the IMF and should not be used

as a means of selecting certain kstar types!

m2_minfloat

kwarg which sets the minimum secondary mass for sampling the secondary as uniform in mass_2 between m2_min and mass_1 Cannot be used in conjunction with qmin

msortfloat

Stars with M>msort can have different pairing and sampling of companions

qmin_msortfloat

Same as qmin for M>msort

m2_min_msortfloat

Same as m2_min for M>msort

SF_startfloat

Time in the past when star formation initiates in Myr

SF_durationfloat

Duration of constant star formation beginning from SF_Start in Myr

binfrac_modelstr or float

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

binfrac_model_msortstr or float

Same as binfrac_model for M>msort

metfloat

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

SSEDict: `Dict`

Sets the engine to use for individual stellar evolution

sizeint

Size of the population to sample

total_massfloat

Total mass to use as a target for sampling

sampling_targetstr

Which type of target to use for sampling (either “size” or “total_mass”), by default “size”. Note that total_mass must not be None when sampling_target==”total_mass”.

trim_extra_samplesstr

Whether to trim the sampled population so that the total mass sampled is as close as possible to total_mass. Ignored when sampling_target==size. Note that given the discrete mass of stars, this could mean your sample is off by 300 solar masses in the worst case scenario (of a 150+150 binary being sampled). In reality the majority of cases track the target total mass to within a solar mass.

zsunfloat

optional kwarg for setting effective radii, default is 0.02

q_power_lawfloat

Exponent for the mass ratio distribution power law, default is 0 (flat in q). Note that q_power_law cannot be exactly -1, as this would result in a divergent distribution.

poolmultiprocessing.Pool

Optional multiprocessing pool to use for parallelizing the sampling. If None, no multiprocessing is used. Default is None.

nprocint

Number of processes to use for multiprocessing if pool is None. Default is 1 (no multiprocessing). If pool is not None, this argument is ignored.

Returns:
InitialBinaryTablepandas.DataFrame

DataFrame in the format of the InitialBinaryTable

mass_singlesfloat

Total mass in single stars needed to generate population

mass_binariesfloat

Total mass in binaries needed to generate population

n_singlesint

Number of single stars needed to generate a population

n_binariesint

Number of binaries needed to generate a population