Skip to content

Commit d3daf62

Browse files
Merge pull request #13 from GEMScienceTools/minor-fixes
Minor fixes in demos and GIFs in installation
2 parents d5c12b4 + 93b5a70 commit d3daf62

File tree

7 files changed

+22
-28
lines changed

7 files changed

+22
-28
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
<p align="center">
2525
This repository contains an open source library that provides modelling of multi-degree-of-freedom systems and assessment via nonlinear time-history analyses for regional vulnerability and risk calculations. The vulnerability toolkit is developed by the Global Earthquake Model (GEM) Foundation and its collaborators.
2626
<br />
27-
<a href="https://github.com/GEMScienceTools/vulnerability-toolkit/docs"><strong>Explore the docs »</strong></a>
27+
<a href="https://gemsciencetools.github.io/oq-vmtk/"><strong>Explore the docs »</strong></a>
2828
<br />
2929
<br />
30-
<a href="https://github.com/GEMScienceTools/vulnerability-toolkit/demos">View Demos</a>
30+
<a href="https://github.com/GEMScienceTools/oq-vmtk/tree/main/demos">View Demos</a>
3131
·
32-
<a href="https://github.com/GEMScienceTools/vulnerability-toolkit/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
32+
<a href="https://github.com/GEMScienceTools/oq-vmtk/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
3333
·
34-
<a href="https://github.com/GEMScienceTools/vulnerability-toolkit/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
34+
<a href="https://github.com/GEMScienceTools/oq-vmtk/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
3535
</p>
3636
</div>
3737

@@ -93,6 +93,9 @@ It is highly recommended to use a **virtual environment** to install this tool.
9393
source .venv/Scripts/activate # On Linux
9494
```
9595

96+
<img src="imgs/virtual-env.gif" alt="Logo" >
97+
98+
9699
### 3. Install Dependencies
97100
Install the required packages listed in `requirements.txt`.
98101

@@ -114,12 +117,18 @@ It is highly recommended to use a **virtual environment** to install this tool.
114117
python --version
115118
```
116119

120+
<img src="imgs/requirements.gif" alt="Logo" >
121+
122+
117123
### 4. Install the Package
118124
Install the `oq-vmtk` package in editable mode:
119125
```bash
120126
pip install -e .
121127
```
122128

129+
<img src="imgs/packaging.gif" alt="Logo" >
130+
131+
123132
## 📼 Demos
124133

125134
The repository includes demo scripts that showcase the functionality of the vulnerability-modellers-toolkit (oq-vmtk). You can find them in the demos folder of the repository.

demos/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ This folder contains an ensemble of example python notebooks demonstrating vario
55
## Example 1: Ground-Motion Record Processing
66
This example provides a workflow for processing ground-motion records, such as spectral analysis and identification if intensity measure values for distinct intensity measure types (e.g., PGA, Arias Intensity, etc.).
77

8-
## Example 2: Nonlinear Time-History Analysis on an MDOF System using Cloud Analysis
9-
This example performs nonlinear time-history analysis on a multi-degree-of-freedom (MDOF) structural system calibrated using SDOF global capacity and using cloud analysis to assess seismic performance.
8+
## Example 2: End-to-End Vulnerability Analysis of an MDOF System using Cloud Analysis
9+
This example performs nonlinear time-history analysis on a multi-degree-of-freedom (MDOF) structural system calibrated using SDOF global capacity and using cloud analysis to assess seismic performance. The example additionally demonstrates postprocessing of cloud analysis results, including fragility curve estimation and vulnerability assessment visualization.
1010

11-
## Example 3: Postprocessing and Visualizing Cloud Analysis Results for Fragility and Vulnerability Analysis
12-
This example demonstrates postprocessing of cloud analysis results, including fragility curve estimation and vulnerability assessment visualization.
13-
14-
## Example 4: Generating and Visualizing Storey Loss Functions
11+
## Example 3: Generating and Visualizing Storey Loss Functions
1512
This example focuses on computing and visualizing storey loss functions, providing insights into seismic damage assessment and economic loss estimation.
1613

1714
Each example includes relevant scripts, input data, and instructions to guide users through the analysis. Feel free to explore and modify them to suit your specific needs!

demos/example_1.ipynb

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,10 @@
4646
},
4747
{
4848
"cell_type": "code",
49-
"execution_count": 1,
49+
"execution_count": null,
5050
"id": "3aa0f9f2-68c4-4201-b9ef-5d90031e4477",
5151
"metadata": {},
52-
"outputs": [
53-
{
54-
"ename": "ModuleNotFoundError",
55-
"evalue": "No module named 'openquake.vmtk'",
56-
"output_type": "error",
57-
"traceback": [
58-
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
59-
"\u001b[31mModuleNotFoundError\u001b[39m Traceback (most recent call last)",
60-
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 8\u001b[39m\n\u001b[32m 5\u001b[39m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mmatplotlib\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mpyplot\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mplt\u001b[39;00m\n\u001b[32m 7\u001b[39m \u001b[38;5;66;03m# Import the IMCalculator class\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m8\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mopenquake\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mvmtk\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mim_calculator\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m IMCalculator \n\u001b[32m 9\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mopenquake\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mvmtk\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mutilities\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m sorted_alphanumeric, export_to_pkl\n",
61-
"\u001b[31mModuleNotFoundError\u001b[39m: No module named 'openquake.vmtk'"
62-
]
63-
}
64-
],
52+
"outputs": [],
6553
"source": [
6654
"import os\n",
6755
"import sys\n",
@@ -162,8 +150,8 @@
162150
"for i in range(len(gmrs)):\n",
163151
" \n",
164152
" ### Load the acceleration time-histories and the time-step files\n",
165-
" current_acc = pd.read_csv(os.path.join(gm_directory,'acc',f'acc_{i}.csv'), header=None).to_numpy()\n",
166-
" current_dts = pd.read_csv(os.path.join(gm_directory,'dts',f'dts_{i}.csv'), header=None).to_numpy()\n",
153+
" current_acc = pd.read_csv(os.path.join(gm_directory,'acc',f'acc_{i}.csv'), header=None).to_numpy().flatten()\n",
154+
" current_dts = pd.read_csv(os.path.join(gm_directory,'dts',f'dts_{i}.csv'), header=None).to_numpy().flatten()\n",
167155
" \n",
168156
" ### Define the time-step of the acceleration time-history\n",
169157
" dt_gm = (current_dts[1] - current_dts[0]).item() # Subtract any consecutive rows of the time-step file\n",

imgs/packaging.gif

14.1 MB
Loading

imgs/requirements.gif

15.2 MB
Loading

imgs/virtual-env.gif

3.49 MB
Loading

openquake/vmtk/slf_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def _validate_component_data_schema(self):
579579
# Validate base fields
580580
id_set = set()
581581
for row in component_data:
582-
model = component_data_model.parse_obj(row)
582+
model = component_data_model.model_validate(row)
583583
if model.Component_ID is not None and model.Component_ID in id_set:
584584
raise ValueError(f'Duplicate ITEM: {model.Component_ID}')
585585
id_set.add(model.Component_ID)
@@ -613,7 +613,7 @@ def _validate_correlation_tree_schema(self,
613613
# Validate base fields
614614
id_set = set()
615615
for row in corr_dict:
616-
model = correlation_tree_model.parse_obj(row)
616+
model = correlation_tree_model.model_validate(row)
617617
if model.ITEM in id_set:
618618
raise ValueError(f'Duplicate ITEM: {model.ITEM}')
619619
id_set.add(model.ITEM)

0 commit comments

Comments
 (0)