vis_tools.Config module#
Config.py
This class is a simple Python wrapper for the config.json file used to configure the DTK.
- Usage::
config = Config(path.join(my_dir, “config.json”)) print config
- class vis_tools.Config.Config(file_path='', verbose=False)[source]#
Bases:
object
Class to hold DTK config.json data.
The class is constructed with the path to the config.json file. Thereafter the public data members source_file, timestamp_count, and parameters may be used to directly access the resultant Python object. There are also accessor methods for the most commonly needed parameters.
- Public members:
The following data members are publicly exposed.
source_file (str): A copy of the file_path used to construct the Config object.
timestep_count (int): The Simulation_Duration parameter.
parameters (obj): The entire config.json as a Python object.
- get_demographics_filenames()[source]#
Return the value of Parameters > Demographics_Filenames.
- Returns:
List of demographics filenames.
- Return type:
list(str)
- Parameters:
None. –
- get_first_demographics_filename()[source]#
Returns the first (or only) demographics file from the config.
This function understands the presence of Demographics_Filename with a single path, Demographics_Filename with multiple paths delimited by ‘;’, and Demographics_Filenames as an array of paths.
- Returns:
- Demographics file name from Demographics_Filenames or
Demographics_Filename, or None.
- Return type:
str
- Parameters:
None. –
- get_demographics_filename_or_list()[source]#
Returns a string or list of demographics filenames, or None.
This function understands the presence of Demographics_Filename with a single path, Demographics_Filename with multiple paths delimited by ‘;’, and Demographics_Filenames as an array of paths.
- Returns:
if a single demographics file is specified in the config, returns it as a string. If an array is specified, returns an array of filenames. Otherwise returns None.
- Return type:
str|list
- Parameters:
None. –