Utility functions (utils)

The utils module contains utility functions for use with COSMIC.

utils

Functions

filter_bin_state(bcm, bpp, method, ...)

Filter the output of bpp and bcm, where the kstar ranges have already been selected by the conv_select module

conv_select(bcm_save, bpp_save, ...)

Select bcm data for special convergence cases

mass_min_max_select(kstar_1, kstar_2, **kwargs)

Select a minimum and maximum mass to filter out binaries in the initial parameter sample to reduce the number of unneccessary binaries evolved in BSE

idl_tabulate(x, f[, p])

Function that replicates the IDL int_tabulated function which performs a p-point integration on a tabulated set of data

rndm(a, b, g, size)

Power-law generator for pdf(x)propto x^{g} for a<=x<=b

param_transform(dat)

Transforms a data set to limits between zero and one Leaves some wiggle room on the edges of the data set

dat_transform(dat, dat_list)

Transform a data set to have limits between zero and one using param_transform, then transform to log space

dat_un_transform(dat_sample, dat_set, dat_list)

Un-transform data that was transformed in dat_transform

knuth_bw_selector(dat_list)

Selects the kde bandwidth using Knuth's rule implemented in Astropy If Knuth's rule raises error, Scott's rule is used

error_check(BSEDict, SSEDict[, filters, ...])

Checks that values in BSEDict, SSEDict,filters, and convergence are viable

check_initial_conditions(...)

Checks initial conditions and reports warnings

convert_kstar_evol_type(bpp)

Provides way to convert integer values to their string counterpart

parse_inifile(inifile)

Provides a method for parsing the inifile and returning dicts of each section

pop_write(dat_store, log_file, mass_list, ...)

Writes all the good stuff that you want to save from runFixedPop in a

a_from_p(p, m1, m2)

Computes the separation from orbital period with KEPLER III

p_from_a(sep, m1, m2)

Computes separation from orbital period with kepler III

get_Z_from_FeH(FeH[, Z_sun])

Converts from FeH to Z under the assumption that all stars have the same abundance as the sun

get_FeH_from_Z(Z[, Z_sun])

Converts from Z to FeH under the assumption that all stars have the same abundance as the sun

get_binfrac_of_Z(Z)

Calculates the theoretical binary fraction as a function of metallicity.

get_porb_norm(Z[, close_logP, wide_logP, ...])

Returns normalization constants to produce log normals consistent with Fig 19 of Moe+19 for the orbital period distribution

get_met_dep_binfrac(met)

Returns a population-wide binary fraction consistent with Moe+19 based on the supplied metallicity

get_METISSE_metallicity_files(path_to_tracks)

Returns the path to the METISSE files

read_metallicity_file(met_file_path)

Read a metallicity namelist

read_format_file(format_file_path)

Read the format file associated with the metallicity namelist

read_MIST_track(eep_path)

read_other_track(eep_path, fmt)

read_eep_directory(eep_dir, fmt_dict)

Read all EEP files in a directory matching the given pattern

to_f2py_str_array(pylist[, maxlen])

Convert Python list of strings to NumPy array of fixed-length strings for F2PY.

explain_setting(setting)

Provides explanation for a BSE setting from the cosmic-settings.json file