Damage Probability Analysis#
Use this module after damage probability calculation has produced an aggregated
probability dictionary. The analysis classes turn ProbDS_wfd arrays into
vulnerability curves, fragility curves, saved JSON, and matplotlib figures.
Classes#
| Page | Use when |
|---|---|
| VulnerabilityCalculator | You need expected damage ratio versus wind speed for one building type and resistance configuration. |
| FragilityCalculator | You need probability of exceeding damage-state thresholds versus wind speed. |
| DamageProbabilityAnalysis | You want vulnerability and fragility outputs from one convenience class. |
Shared Inputs#
| Input | Default | Shape | Units or indexing |
|---|---|---|---|
prob_ds_file_path |
Outputs/ProbDS_wfd_dictMaxIter{NUM_OF_ITERATIONS}_aggregated.pkl |
dict[(m, c), array] |
Keys use building type and 1-based resistance/configuration id. |
Inputs/WindSpeed.json |
runtime file | [25, 3] |
id, mph, m/s; plots use mph. |
Inputs/FloodDepth.json |
runtime file | [136, 3] |
id, inches, meters. |
Inputs/DamageState.json |
runtime file | [50, 2] |
damage-state id, damage ratio. |
building_type |
1 |
scalar | Building type key m. |
resistance_type |
1 |
scalar | Component/resistance key c, 1-based. |
The current calculations use flood-depth index 0 for wind-only vulnerability
and fragility curves.
Configuration Behavior#
Config.AUTO_LOAD_DATASETS=True loads the probability dictionary, wind grid,
flood grid, and damage-state table during initialization. With False, call
the load_* methods before running calculations.
Config.AUTO_EXECUTE_METHODS=True computes outputs during construction for
VulnerabilityCalculator and FragilityCalculator; DamageProbabilityAnalysis
inherits both behaviors. With False, call calculation methods manually and
assign returned values if you want them stored on the instance.
Minimal Examples#
Automatic calculation:
from cheersafe.config import Config
from cheersafe.damage_probability_analysis import DamageProbabilityAnalysis
Config.AUTO_LOAD_DATASETS = True
Config.AUTO_EXECUTE_METHODS = True
analysis = DamageProbabilityAnalysis(
building_type=1,
resistance_type=1,
prob_ds_file_path="Outputs/ProbDS_wfd_dictMaxIter50_aggregated.pkl",
)
results = analysis.generate_analysis()
Manual control:
from cheersafe.config import Config
from cheersafe.damage_probability_analysis import DamageProbabilityAnalysis
Config.AUTO_LOAD_DATASETS = False
Config.AUTO_EXECUTE_METHODS = False
analysis = DamageProbabilityAnalysis(
building_type=1,
resistance_type=1,
prob_ds_file_path="Outputs/ProbDS_wfd_dictMaxIter50_aggregated.pkl",
)
analysis.load_prob_damage_states()
analysis.load_wind_speed()
analysis.load_flood_depth()
analysis.load_damage_state()
analysis.expected_damage_ratio, analysis.vulnerability_curve = (
analysis.calculate_vulnerability_curve()
)
analysis.fragility_curves = analysis.calculate_fragility_curves()
Related References#
- API: Damage Probability Analysis
- Related notebook: Fragility Curve Calculation