Population class extension: grid_options_defaults module

Module that contains the default options for the population grid code along with the description for these options, in the form of dictionaries:
  • grid_options_defaults_dict: dictionary containing the default values for all the options

  • grid_options_descriptions: dictionary containing the description for these options.

There are several other functions in this module, mostly to generate help texts or documents:
  • grid_options_help: interactive function for the user to get descriptions for options

  • grid_options_description_checker: function that checks that checks which options have a description.

  • write_grid_options_to_rst_file: function to generate the .rst document for the docs

With this its also possible to automatically generate a document containing all the setting names + descriptions.

All the options starting with _ should not be changed by the user except when you really know what you’re doing (which is probably hacking the code :P)

TODO: reconsider having this all as class methods. It seems unnecessary to have all these functions as class methods.

class binarycpython.utils.population_extensions.grid_options_defaults.grid_options_defaults(**kwargs)[source]

Bases: object

Class extension to Population grid containing all the functionality for the options and defaults

default_cache_dir()[source]

Return a default cache directory path, or None if we cannot find one.

get_grid_options_defaults_dict()[source]

Function to return the default values for the grid options

get_grid_options_descriptions()[source]

Function that returns the descriptions for all the grid options

TODO: consider putting input types for all of them

grid_options_description_checker(print_info=True)[source]

Function that checks which descriptions are missing

Parameters

print_info (bool) – whether to print out information about which options contain proper descriptions and which do not

Return type

int

Returns

the number of undescribed keys

grid_options_help(option)[source]

Function that prints out the description of a grid option. Useful function for the user.

Parameters

option (str) – which option you want to have the description of

Return type

dict

Returns

dict containing the option, the description if its there, otherwise empty string. And if the key doesnt exist, the dict is empty

print_option_descriptions(filehandle, options, descriptions, title, extra_text)[source]

Function to print the description of an option

write_grid_options_to_rst_file(output_file)[source]

Function that writes the descriptions of the grid options to an rst file

Parameters

output_file (str) – target file where the grid options descriptions are written to

Return type

None