Tutorial: Extra features and functionality of binary_c-python

In this notebook we’ll go over some of the extra features and functionality that was not covered in the other notebooks.

Within the module binarycpython.utils.functions there are many functions that can be useful when using binarycpython. We can see which functions are in there, again by using the help()

[1]:
from binarycpython.utils.functions import (
    get_help,
    get_help_all,
    get_help_super,
    return_binary_c_version_info,
    get_defaults
)
# help(binarycpython.utils.functions)

getting extra information about binary_c parameters

There are several functions that can be used to get information about the parameters in binary_c:

  • get_help(parameter): Function to get information about the specific input parameter. Prints the output on default but returns a dictionary containing the information.

  • get_help_all(print_help=True): Function to get information about all the parameters. Prints the output on default but returns a dictionary containing the information.

  • get_help_super(): Function to get even more information about all the parameters. Does not print the output on default but returns a dictionary containing the information.

  • get_defaults(): Function that will get all the default values for the parameters. Returns a dictionary

[2]:
get_help('M_1')
parameter_name:
        M_1
parameter_value_input_type:
        Float
description:
        The initial mass of star one (in solar units, internally this is star index 0).
default:
        0
[2]:
{'parameter_name': 'M_1',
 'parameter_value_input_type': 'Float',
 'description': 'The initial mass of star one (in solar units, internally this is star index 0).',
 'default': '0'}
[3]:
# get_help_all()
[4]:
# get_help_super()
[5]:
# get_defaults()

Build information of binary_c

Sometimes we want to know with which settings binary_c has been built. We can use the function return_binary_c_version_info for this. This function will parse the version info of binary_c and return a dictionary with all the settings.

[6]:
version_info_dict = return_binary_c_version_info(parsed=True)
print(version_info_dict.keys())
dict_keys(['networks', 'isotopes', 'argpairs', 'ensembles', 'ensemble_filters', 'macros', 'elements', 'dt_limits', 'nucleosynthesis_sources', 'miscellaneous'])

Example parse function

TODO: In the functions module there is an example parse function that can be used in conjunction with run_system.

[ ]:

Dictionary modification

  • merge_dicts

  • update_dicts

  • multiply_values_dict

TODO:

Getting help

[ ]: