Configuration#
The configuration module provides configuration management for the CHEERSafe package.
Class Diagram#
classDiagram
class Config {
<<dataclass>>
+bool AUTO_EXECUTE_METHODS$
+bool AUTO_LOAD_DATASETS$
+str INPUTS_PATH$
+str OUTPUTS_PATH$
+int NUM_OF_ITERATIONS$
+int NUM_OF_WORKERS$
+int NUM_OF_WORKERS_SAMPLING$
+bool EXPORT_DETAILED_DAMAGE_RATIOS$
+reset_flags()$ None
}
Configuration#
configuration
#
Classes:
| Name | Description |
|---|---|
Config |
A configuration management class for the CHEERSafe package. |
Config
dataclass
#
Config(
AUTO_EXECUTE_METHODS: bool = True,
AUTO_LOAD_DATASETS: bool = True,
INPUTS_PATH: str = "Inputs",
OUTPUTS_PATH: str = "Outputs",
NUM_OF_ITERATIONS: int = 3000,
NUM_OF_WORKERS: int = 4,
NUM_OF_WORKERS_SAMPLING: int = 1,
RANDOM_SEED: int = 42,
EXPORT_DETAILED_DAMAGE_RATIOS: bool = False,
)
A configuration management class for the CHEERSafe package.
This class provides global configuration settings for the CHEERSafe hurricane damage and loss assessment model. It manages execution behavior, data loading preferences, file paths, and processing parameters used throughout the package.
Attributes:
| Name | Type | Description |
|---|---|---|
AUTO_EXECUTE_METHODS |
bool
|
Flag to control automatic execution of methods. When True, methods are executed automatically during object initialization. Default is True. |
AUTO_LOAD_DATASETS |
bool
|
Flag to control automatic loading of datasets. When True, datasets are loaded automatically during object initialization. Default is True. |
INPUTS_PATH |
str
|
The directory path where input data files are stored. Default is 'Inputs'. |
OUTPUTS_PATH |
str
|
The directory path where output files will be saved. Default is 'Outputs'. |
NUM_OF_ITERATIONS |
int
|
The number of iterations to perform in Monte Carlo simulations and other iterative processes. Default is 3000. |
NUM_OF_WORKERS |
int
|
The number of parallel workers to use for multi-threaded operations. Default is 4. |
NUM_OF_WORKERS_SAMPLING |
int
|
The number of parallel workers to use specifically for sampling operations. Default is 1. |
RANDOM_SEED |
int
|
The default random seed used for reproducible stochastic calculations. Default is 42. |
EXPORT_DETAILED_DAMAGE_RATIOS |
bool
|
Flag to enable export of detailed damage ratio breakdowns to CSV files. When True, detailed component-level damage ratios are collected during Monte Carlo simulation and saved as CSV files per (building_type, cindex) combination. This is computationally expensive and disabled by default. Default is False. |
Methods:
| Name | Description |
|---|---|
reset_flags |
Resets all configuration parameters to their default values. |
reset_flags
classmethod
#
Reset all configuration parameters to their default values.
This class method restores all configuration attributes to their original default values. This is useful for resetting the configuration state during testing or when switching between different analysis configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type
|
The Config class. |
required |
Outputs
Updates the following class attributes:
AUTO_EXECUTE_METHODS(bool): Reset to TrueAUTO_LOAD_DATASETS(bool): Reset to TrueINPUTS_PATH(str): Reset to 'Inputs'OUTPUTS_PATH(str): Reset to 'Outputs'NUM_OF_ITERATIONS(int): Reset to 3000NUM_OF_WORKERS(int): Reset to 4NUM_OF_WORKERS_SAMPLING(int): Reset to 1RANDOM_SEED(int): Reset to 42EXPORT_DETAILED_DAMAGE_RATIOS(bool): Reset to False
Returns:
| Type | Description |
|---|---|
None
|
None |