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 import Population
from binarycpython.utils.functions import (
get_help,
get_help_all,
get_help_super,
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
It can be useful to fetch the information with which the current version of binary_c has been configured with. We can do that through the Population object, by calling the instance method return_binary_c_version_info
. This function will parse the version info of binary_c and return a dictionary with all the settings.
[6]:
version_info = Population().return_binary_c_version_info(parsed=True)
print(version_info.keys())
dict_keys(['networks', 'isotopes', 'argpairs', 'ensembles', 'ensemble_filters', 'macros', 'elements', 'dt_limits', 'units', '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: