Command line interface (cli package)

Argument parsing

class gadma.cli.arg_parser.ArgParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True)

Bases: argparse.ArgumentParser

Overrided class for argument parser.

format_help()

Returns usage by calling usage().

gadma.cli.arg_parser.get_settings()

Parse args from command line and store them in options_storage.

Returns

tuple of parsed arguments and settings storage.

gadma.cli.arg_parser.test_args()

Put default args for test case.

gadma.cli.arg_parser.usage()

Returns usage of tool.

gadma.cli.arg_parser.version()

Returns string with current version.

SettingsStorage

class gadma.cli.settings_storage.SettingsStorage

Bases: object

Class to hold all settings of GADMA run. All default values of settings are defined in gadma.cli.settings.

property bootstrap_data
property fractions
static from_file(param_file, extra_param_file=None)

Creates new object with settings from files.

Parameters
  • param_file – File with base parameters.

  • extra_param_file – File with extra parameters.

get_engine_args(engine_id=None)

Returns args of engine.evaluate() function.

get_global_optimizer()

Return object of global optimizer for optimization according to current settings.

get_linear_constrain_for_model(model)

Returns linear constrain for model based of setted upper bound of splits. NOT WORKING.

get_local_optimizer()

Return object of local optimizer for optimization according to current settings.

get_model()

Returns demographic model to use according to current settings.

get_optimizers_init_kwargs()

Returns kwargs for first run of optimization. (X_init and Y_init).

get_optimizers_kwargs()

Returns kwargs for optimizations. (args and verbose).

property inner_data
read_bootstrap_data(return_filenames=False)

Reads all data in the directory self.bootstrap_data.

Parameters

return_filenames – If True then each data is a tuple of corresponding filename and data.

read_data()

Reads data with engine. Attribute of`engine` and data_holder should be set.

to_files(params_file, extra_params_file)

Saves current options to files.

Parameters
  • params_file – File with base parameters.

  • extra_param_file – File with extra parameters.

update_from_file(param_file, extra_param_file=None)

Updates settings by reading new from files.

Parameters
  • param_file – File with base parameters.

  • extra_param_file – File with extra parameters.