Config
- class Config(conf_filename='./config.json', custom_config=None)[source]
Bases:
objectInitialize and load the configuration used by cases and exporters.
The config reads a json from a file or in-line which contains paths to the case to load, the plots directory, and the logs directory. It is passed later directly to different other modules to use its information.
You can modify the paths in runtime by using the dedicated setter methods.
If
custom_configis provided, it overrides any file-based configuration andconf_filenameis ignored.A config must always be a dictionary with the following format and fields: {
“case_path”: “path/to/the/input/case/directory/or/file”, “plot_path”: “path/to/the/output/plot/directory”, “log_path”: “path/to/the/output/logs/directory”
}
- Parameters:
- Returns:
None
- set_other_field(field, value)[source]
Set a custom field in the configuration dictionary.
- Parameters:
field (str) – The name of the field to set.
value – The value to assign to the field.
- Returns:
None
- set_case_path(new_path)[source]
Set the case path in the configuration.
- Parameters:
new_path (str) – The new path to the case directory.
- Returns:
None
- set_plot_path(new_path)[source]
Set the directory where plots should be written.
- Parameters:
new_path (str) – The new path to the plots directory.
- Returns:
None
- set_log_path(new_path)[source]
Set the directory where logs should be stored.
- Parameters:
new_path (str) – The new path to the logs directory.
- Returns:
None
- get_config()[source]
Get the full configuration dictionary.
- Return dict:
The active configuration as a Python dictionary.
- Return type:
- get_other_field(field)[source]
Get the value of a custom configuration field, if it exists.
- Parameters:
field (str) – The name of the field to retrieve.
- Returns:
The value of the field if present, otherwise
None.
- get_case_path()[source]
Get the configured case path.
- Return str:
The path to the case directory.
- Return type:
- get_plot_path()[source]
Get the directory where plots are stored.
- Return str:
The path to the plots directory.
- Return type:
- get_log_path()[source]
Get the directory where logs are stored.
- Return str:
The path to the logs directory.
- Return type: