Skip to content
Snippets Groups Projects
Commit 458d9e86 authored by David Hendriks's avatar David Hendriks
Browse files

fixing tests and docs

parent de2ae659
No related branches found
No related tags found
No related merge requests found
......@@ -85,30 +85,29 @@ def binary_c_log_code(code: str, verbose: int=0) -> str:
Function to construct the code to construct the custom logging function
Example:
Code to log and terminate evolution when the primary star becomes a NS
Code to log and terminate evolution when the primary star becomes a NS::
::
if(stardata->star[0].stellar_type>=NS)
{
if (stardata->model.time < stardata->model.max_evolution_time)
if(stardata->star[0].stellar_type>=NS)
{
Printf("EXAMPLE_LOG_CO %30.12e %g %g %g %g %d %d\\n",
//
stardata->model.time, // 1
stardata->star[0].mass, //2
stardata->previous_stardata->star[0].mass, //3
stardata->star[0].radius, //4
stardata->previous_stardata->star[0].radius, //5
stardata->star[0].stellar_type, //6
stardata->previous_stardata->star[0].stellar_type //7
);
if (stardata->model.time < stardata->model.max_evolution_time)
{
Printf("EXAMPLE_LOG_CO %30.12e %g %g %g %g %d %d\\n",
//
stardata->model.time, // 1
stardata->star[0].mass, //2
stardata->previous_stardata->star[0].mass, //3
stardata->star[0].radius, //4
stardata->previous_stardata->star[0].radius, //5
stardata->star[0].stellar_type, //6
stardata->previous_stardata->star[0].stellar_type //7
);
};
/* Kill the simulation to save time */
stardata->model.max_evolution_time = stardata->model.time - stardata->model.dtm;
};
/* Kill the simulation to save time */
stardata->model.max_evolution_time = stardata->model.time - stardata->model.dtm;
};
Args:
code: Exact c-statement to output information in binary_c. Can be wrapped in logical statements.
......@@ -116,7 +115,6 @@ def binary_c_log_code(code: str, verbose: int=0) -> str:
Returns:
string containing the custom logging code. This includes all the includes and other definitions. This code will be used as the shared library
"""
verbose_print("Creating the code for the shared library for the custom logging", verbose, 0)
......
......@@ -102,21 +102,21 @@ def plot_HR_diagram(
log temperature on x axis (reversed)
requires:
time
stellar_type_1
stellar_type_2
radius_1
radius_2
luminosity_1
luminosity_2
- time
- stellar_type_1
- stellar_type_2
- radius_1
- radius_2
- luminosity_1
- luminosity_2
Plots:
luminosity_1 vs teff_1
luminosity_2 vs teff_2
- luminosity_1 vs teff_1
- luminosity_2 vs teff_2
Tasks:
TODO: add HD limit
TODO: add lines of constant radius
- TODO: add HD limit
- TODO: add lines of constant radius
Args:
df: pandas dataframe with the required columns
......@@ -296,7 +296,7 @@ def plot_masses(df, show_stellar_types: bool=False, show_plot: bool=True):
- Pms mass 1
- pms mass 2
- pms total mass
(maybe?) core and env masses
- (maybe?) core and env masses
Args:
df: pandas dataframe with the required columns
......@@ -500,30 +500,31 @@ def plot_system(plot_type, **kwargs):
- a preset custom logging for a specific plotting routine is loaded, depending on the choice of plot_type
- This is used for the run_system call
- The output of this run_system is loaded into a dataframe by
parsing it with a corresponding parsing function
parsing it with a corresponding parsing function
- The dataframe is passed to the plotting routine
- plot is shown or returned.
There are several pre-set plots to choose from:
mass_evolution
orbit_evolution
hr_diagram
- mass_evolution
- orbit_evolution
- hr_diagram
Tasks:
TODO: Complex Function!
TODO: make sure this way of passing args works correctly.
TODO: make the plotting specific keywords available via the inspect stuff
- TODO: Complex Function!
- TODO: make sure this way of passing args works correctly.
- TODO: make the plotting specific keywords available via the inspect stuff
All keywords are considered kwargs, except for plot_type
Args:
plot_type: string input should be one of the following types:
['mass_evolution', 'orbit_evolution', 'hr_diagram'].
Input will be matched against this,
and then go through a dictionary to pick the correct plotting function.
plot_type: string input should be one of ['mass_evolution', 'orbit_evolution', 'hr_diagram'].
Input will be matched against this, and then go through a dictionary to pick the correct plotting function.
return_fig: boolean whether to return the fig object instead of plotting the plot
(makes so that you can customize it)
show_stellar_types: whether to plot the stellar type evolution on a second pane.
This is not included in all the plotting routines.
Other input: other kwargs that are passed to run_system
(inspect the docstring of run_system for more info)
......
......@@ -20,18 +20,19 @@ def run_system(**kwargs):
Function that runs a system.
Mostly as a useful utility function that handles all the setup of argument lists etc.
examples:
* run_system(M_1=10): will run a system with ZAMS mass 1 = 10
* run_system(M_1=10, log_filename="~/example_log.txt"): Will run a system
Examples:
- run_system(M_1=10): will run a system with ZAMS mass 1 = 10
- run_system(M_1=10, log_filename="~/example_log.txt"): Will run a system
and write the logfile too
* run_system(M_1=10, parse_function=fancy_parsing_function)
- run_system(M_1=10, parse_function=fancy_parsing_function)
Tasks:
TODO: Expand functionality.
TODO: Notify user when an unknown keyword is passed.
- TODO: Expand functionality.
- TODO: Notify user when an unknown keyword is passed.
All~ the arguments known to binary_c can be passed to this function as kwargs.
Several extra arguments can be passed through the kwargs:
Kwargs:
custom_logging_code (string):
Should contain a string containing the c-code for the shared library.
If this is provided binary_c will use that custom logging code to output its data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment