repast4py.parameters module

The parameters module contains functions for working with model input parameters.


Creates an argparse parser with two arguments: 1) a yaml format file containing model parameter input, and 2) an optional json dictionary string that can override that input.

This function is intended to work in concert with the repast4py.parameters.init_params() function where the results of the argparse argument parsing are passed as arguments to that function.


>>> parser = create_args_parser()
>>> args = parser.parse_args()
>>> params = init_params(args.parameters_file, args.parameters)
repast4py.parameters.init_params(parameters_file, parameters, dump_file=None)

Initializes the repast4py.parameters.params dictionary with the model input parameters.

This reads the parameters file, overrides any of those parameter values with those in the parameters string. This will automatically set the random number generator’s seed if the parameters file or the parameters string contain a ‘random.seed’ parameter.

  • parameters_file (str) – yaml format file containing model parameters as key value pairs.

  • parameters (str) – json map format string that overrides those in the file.

  • dump_file (Optional[str]) – optional file name to dump the resolved parameters to.


A dictionary containing the final model parameters.

Return type:


repast4py.parameters.params = {}

After calling repast4py.parameters.init_params(), this dictionary will contain the model parameters.