# msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
# msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
# msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
"adding: parse_function=<function object_parse_function at 0x7fa30c1f86a8> to grid_options\n",
"adding: parse_function=<function object_parse_function at 0x7fa3136e5378> to grid_options\n",
"<<<< Warning: Key does not match previously known parameter: adding: output_dir=/tmp/binary_c_python/notebooks/notebook_individual_systems to custom_options >>>>\n",
"adding: api_log_filename_prefix=/tmp/binary_c_python/notebooks/notebook_individual_systems to BSE_options\n",
"Creating and loading custom logging functionality\n",
This notebook will show you how to run single systems and analyze their results.
It can be useful to have some functions to quickly run a single system to e.g. inspect what evolutionary steps a specific system goes through, to plot the mass loss evolution of a single star, etc.
The simplest method to run a single system is to use the run_system wrapper. This function deals with setting up the argument string, makes sure all the required parameters are included and handles setting and cleaning up the custom logging functionality (see notebook_custom_logging).
As arguments to this function we can add any of the parameters that binary_c itself actually knows, as well as:
- custom_logging_code: string containing a print statement that binary_c can use to print information
- log_filename: path of the logfile that binary_c generates
- parse_function: function that handles parsing the output of binary-c
Now we have some actual output, it is time to create a parse_function which parses the output. Adding a parse_function to the run_system will make run_system run the output of binary_c through the parse_function.
When setting up your population object (see notebook_population), and configuring all the parameters, it is possible to run a single system using that same configuration. It will use the parse_function if set, and running a single system is a good method to test if everything works accordingly.
Lastly we can add a parse_function to handle parsing the output again.
Because the parse_function will now be part of the population object, it can access information of the object. We need to make a new parse function that is fit for an object: we the arguments now need to be (self, output). Returning the data is useful when running evolve_single(), but won't be used in a population evolution.
adding: parse_function=<function object_parse_function at 0x7fa30c1f86a8> to grid_options
adding: parse_function=<function object_parse_function at 0x7fa3136e5378> to grid_options
<<<< Warning: Key does not match previously known parameter: adding: output_dir=/tmp/binary_c_python/notebooks/notebook_individual_systems to custom_options >>>>
adding: api_log_filename_prefix=/tmp/binary_c_python/notebooks/notebook_individual_systems to BSE_options
It is possible to construct your own functionality to run a single system by directly calling the API function to run a system. Under the hood all the other functions and wrappers actually use this API.
There are less failsafes for this method, so this make sure the input is correct and binary_c knows all the arguments you pass in.
for more details on this API function see `notebook_api_functions`
As we can see above, the output is rather empty. But if SINGLE_STAR_LIFETIME is printed we know we caught the output correctly. To get actual output we should have timesteps printed in the `log_every_timestep.c` in binary_c, or add some custom_logging (see notebook_custom_logging).