synthpops.config module

This module sets the location of the data folder and other global settings.

To change the level of log messages displayed, use e.g.

sp.logger.setLevel(‘CRITICAL’)
checkmem(unit='mb', fmt='0.2f', start=0, to_string=True)[source]

For use with logger, check current memory usage

version_info()[source]
set_location_defaults(country_location=None)[source]
set_datadir(root_dir, relative_path=None)[source]

Set the data folder and relative path to the user-specified location.

On startup, the datadir and rel_path are set to the conventions used to store data. datadir is the root directory to the data, and relative_path is a list of sub directories to the data –> to change the location of the data the user is able to supply a new root_dir and new relative path. If the user uses a similar directory path model that we use e.g. root_dir/demographics/contact… the user can change datadir without changing relative path, by passing in relative_path = None (default) – note, mostly deprecated but still functional if needed.

Parameters:
  • root_dir (str) – new root directory for the data folder to point to
  • relative_path (str) – new relative path to the root_dir
Returns:

path to the updated settings.datadir

Return type:

str

set_nbrackets(n)[source]

Set the number of census brackets – usually 16, 18 or 20.

validate_datadir(verbose=True)[source]

Check that the data folder can be found.