<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Generation of capacity curves using DBELA
This notebook enables the user to generate capacity curves (in terms of spectral acceleration vs. spectral displacement) using the Displacement-based Earthquake Loss Assessment (DBELA) approach. The DBELA methodology permits the calculation of the displacement capacity of a collection of structures at a number of limit states (which could be structural or non-structural). These displacements are derived based on the capacity of an equivalent SDOF structure, following the principles of structural mechanics (Crowley et al., 2004; Bal et al., 2010; Silva et al., 2013). The figure below illustrates various capacity curves generated using this approach.
<img src="../../../../figures/synthethic_capacity_curves.png" width="350" align="middle">
Note
Step1:  Load geometric and material properties
In order to use this methodology it is necessary to define a building model, which specifies the probabilistic distribution of the geometrical and material properties. These models need to be defined according to the format described in the RMTK manual. Please specify below the paths for the input files containing the building model and damage model
Step2:  Number of samples
The parameter no_assets below controls the number of synthetic structural models or assets (each one with unique geometrical and material properties) that will be generated using a Monte Carlo sampling process
Step3:  Generate the capacity curves
Step4:  Plot the capacity curves
Step5:  Include additional information
Additional information can be added to the capacity curves generated using the above method. For instance, by setting appropriate values for the parameters gamma and yielding_point_index in the cell below, the add_information function can be used to include this data in the previously generated capacity curves.
Step6:  Save capacity curves
Please specify below the path for the output file to save the capacity curves
<ASSISTANT_TASK:>
Python Code:
import DBELA
from rmtk.vulnerability.common import utils
%matplotlib inline
Explanation: Generation of capacity curves using DBELA
This notebook enables the user to generate capacity curves (in terms of spectral acceleration vs. spectral displacement) using the Displacement-based Earthquake Loss Assessment (DBELA) approach. The DBELA methodology permits the calculation of the displacement capacity of a collection of structures at a number of limit states (which could be structural or non-structural). These displacements are derived based on the capacity of an equivalent SDOF structure, following the principles of structural mechanics (Crowley et al., 2004; Bal et al., 2010; Silva et al., 2013). The figure below illustrates various capacity curves generated using this approach.
<img src="../../../../figures/synthethic_capacity_curves.png" width="350" align="middle">
Note: To run the code in a cell:
Click on the cell to select it.
Press SHIFT+ENTER on your keyboard or press the play button (<button class='fa fa-play icon-play btn btn-xs btn-default'></button>) in the toolbar above.
End of explanation
building_model_file = "../../../../../rmtk_data/DBELA/bare_frames.csv"
damage_model_file = "../../../../../rmtk_data/damage_model_dbela_low_code.csv"
Explanation: Load geometric and material properties
In order to use this methodology it is necessary to define a building model, which specifies the probabilistic distribution of the geometrical and material properties. These models need to be defined according to the format described in the RMTK manual. Please specify below the paths for the input files containing the building model and damage model:
End of explanation
no_assets = 100
Explanation: Number of samples
The parameter no_assets below controls the number of synthetic structural models or assets (each one with unique geometrical and material properties) that will be generated using a Monte Carlo sampling process:
End of explanation
building_class_model = DBELA.read_building_class_model(building_model_file)
assets = DBELA.generate_assets(building_class_model, no_assets)
damage_model = utils.read_damage_model(damage_model_file)
capacity_curves = DBELA.generate_capacity_curves(assets, damage_model)
Explanation: Generate the capacity curves
End of explanation
utils.plot_capacity_curves(capacity_curves)
Explanation: Plot the capacity curves
End of explanation
gamma = 1.2
yielding_point_index = 1.0
capacity_curves = utils.add_information(capacity_curves, "gamma", "value", gamma)
capacity_curves = utils.add_information(capacity_curves, "yielding point", "point", yielding_point_index)
Explanation: Include additional information
Additional information can be added to the capacity curves generated using the above method. For instance, by setting appropriate values for the parameters gamma and yielding_point_index in the cell below, the add_information function can be used to include this data in the previously generated capacity curves.
End of explanation
output_file = "../../../../../rmtk_data/capacity_curves_dbela.csv"
utils.save_SdSa_capacity_curves(capacity_curves, output_file)
Explanation: Save capacity curves
Please specify below the path for the output file to save the capacity curves:
End of explanation
<END_TASK>