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

added interface function for the description of options/settings. need to...

added interface function for the description of options/settings. need to change some things but works now
parent 0f66f6b1
No related branches found
No related tags found
No related merge requests found
"""
File containing a dictionary which holds the description for all the grid_options settings.
Using this, together with the accompanied function, the user can interactively check what the settings result in.
With this its also possible to automatically generate a pdf file containing all the setting names + descriptions.
TODO: change the options that one should not use (i.e. the things that are set by the grid itself) to start with an underscore
"""
from binarycpython.utils.grid_options_defaults import grid_options_defaults_dict
# Grid containing the descriptions of the options
grid_options_descriptions = {
'tmp_dir': "Directory where certain types of output are stored. The grid code is stored in that directory, as well as the custom logging libraries. Log files and other diagnostics will usually be written to this location, unless specified otherwise", # TODO: improve this
'binary_c_dir': 'Director where binary_c is stored. This options are not really used',
'binary_c_config_executable': 'Full path of the binary_c-config executable. This option is not really used.',
'binary_c_executable': 'Full path to the binary_c executable. This options is not really used.',
'binary_c_shared_library': "Full path to the libbinary_c file. This option is not really used",
'verbosity': 'Verbosity of the population code. Default is 0, by which only errors will be printed. Higher values will show more output, which is good for debugging.',
'binary': "Set this to 1 if the population contains binaries. Input: int", # TODO: write what effect this has.
'amt_cores': "The amount of cores that the population grid will use. The multiprocessing is useful but make sure to figure out how many logical cores the machine has. The core is multiprocessed, not multithreaded, and will gain no extra speed when amt_cores exceeds the amount of logical cores. Input: int"
}
def grid_options_help(option):
"""
Function that returns the description of a grid option
"""
option_keys = grid_options_defaults_dict.keys()
description_keys = grid_options_descriptions.keys()
if not option in option_keys:
print("Error: This is an invalid entry. Option does not exist, please choose from the following options:\n\t{}".format(', '.join(option_keys)))
else:
if not option in description_keys:
print("This option has not been described properly yet. Please contact on of the authors")
else:
print(grid_options_descriptions[option])
def grid_options_description_checker(print_info=True):
"""
Function that checks which descriptions are missing
"""
option_keys = grid_options_defaults_dict.keys()
description_keys = grid_options_descriptions.keys()
undescribed_keys = list(set(option_keys)-set(description_keys))
if undescribed_keys:
if print_info:
print("Warning: the following keys have no description yet:\n\t{}".format(", ".join(sorted(undescribed_keys))))
print("Total description progress: {:.2f}%%".format(100 * len(description_keys)/len(option_keys)))
return len(undescribed_keys)
grid_options_help('amt_cores')
grid_options_description_checker()
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