Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ OQ-VMTK is released under the **GNU Affero General Public License v3.0 (AGPL-3.0

[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

You are free to use, modify, and distribute this software under the terms of the AGPL v3. Any modifications made to the source code must also be released under the same licence. See the [LICENSE](./LICENSE) file for the full licence text.
You are free to use, modify, and distribute this software under the terms of the AGPL v3. Any modifications made to the source code must also be released under the same licence. See the [LICENSE](./LICENSE.txt) file for the full licence text.

---

Expand Down Expand Up @@ -274,4 +274,4 @@ Contributions are welcome. Please read the [contributing guidelines](./contribut
[issues-shield]: https://img.shields.io/github/issues/GEMScienceTools/oq-vmtk?style=for-the-badge
[issues-url]: https://github.com/GEMScienceTools/oq-vmtk/issues
[license-shield]: https://img.shields.io/github/license/GEMScienceTools/oq-vmtk?style=for-the-badge
[license-url]: https://github.com/GEMScienceTools/oq-vmtk/blob/master/LICENSE.txt
[license-url]: https://github.com/GEMScienceTools/oq-vmtk/blob/main/LICENSE.txt
924 changes: 342 additions & 582 deletions demos/IncrementalDynamicAnalysis/IncrementalDynamicAnalysis.ipynb

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 25 additions & 25 deletions demos/IntensityMeasureSelection/IntensityMeasureSelection.ipynb

Large diffs are not rendered by default.

Binary file modified demos/IntensityMeasureSelection/out/mca_rsm_heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demos/IntensityMeasureSelection/out/mca_vs_ida_metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 127 additions & 7 deletions demos/ModalAnalysis/ModalAnalysis.ipynb

Large diffs are not rendered by default.

Binary file modified demos/ModalAnalysis/out/modal_analysis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions demos/ModelCompilation/ModelCompilation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 6,
"id": "e897a0c1-47ed-469b-bdb6-61d7f23a14e9",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -347,7 +347,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 7,
"id": "0d683c4f",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -401,7 +401,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 8,
"id": "2dafd575-43ab-4dc8-b783-a689b2e4d8ef",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -470,7 +470,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
291 changes: 122 additions & 169 deletions demos/ModifiedCloudAnalysis/ModifiedCloudAnalysis.ipynb

Large diffs are not rendered by default.

Binary file modified demos/ModifiedCloudAnalysis/out/cloud_analysis_bootstrap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demos/ModifiedCloudAnalysis/out/demand_profiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
557 changes: 429 additions & 128 deletions demos/MultipleStripeAnalysis/MultipleStripeAnalysis.ipynb

Large diffs are not rendered by default.

Binary file modified demos/MultipleStripeAnalysis/out/fragility_curves.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
93 changes: 76 additions & 17 deletions demos/PushoverAnalysis/PushoverAnalysis.ipynb

Large diffs are not rendered by default.

Binary file modified demos/PushoverAnalysis/out/cpo_animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demos/PushoverAnalysis/out/spo_animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 38 additions & 4 deletions openquake/vmtk/modeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,11 +1781,41 @@ def do_cpo_analysis(
# Data Recording (only if successful)
if ok == 0:
curr_disp = ops.nodeDisp(control_node, push_dir)
cpo_top_disp.append(curr_disp)

current_floor_disps = [
ops.nodeDisp(node, push_dir) for node in pattern_nodes
]

# Direct nodal cross-check: once a spring's material
# dies, the storeys above it can decouple into a
# zero-stiffness mechanism that DisplacementControl
# still reports as "converged", with the affected
# floors jumping to wildly divergent displacements
# even though eleResponse('deformation') below stays
# frozen under the MinMax bound (it reflects the last
# valid material state, not the true nodal motion).
# Catch that case from the raw nodal displacements
# *before* recording them, so no divergent step is
# ever appended to the results.
prev_disp = 0.0
for s_idx, floor_disp in enumerate(current_floor_disps):
storey_disp = abs(floor_disp - prev_disp)
prev_disp = floor_disp
if storey_disp >= minmax_limits[s_idx]:
if pFlag:
print(
f"Interstorey displacement at "
f"storey {s_idx + 1} reached "
f"ultimate limit ({storey_disp:.4f} "
f">= {minmax_limits[s_idx]:.4f}) "
f"— stopping CPO analysis."
)
minmax_failed = True
break

if minmax_failed:
break

cpo_top_disp.append(curr_disp)
cpo_disps.append(current_floor_disps)

ops.reactions()
Expand Down Expand Up @@ -1864,10 +1894,14 @@ def do_cpo_analysis(
pseudo_steps = np.arange(len(energy_steps))
cpo_energy = np.column_stack((pseudo_steps, energy_steps))

# Calculate Interstorey Drifts
# Calculate Interstorey Drift Ratios (IDR), consistent with
# do_spo_analysis: normalise interstorey displacements by storey
# height and express as a percentage.
base_disps = np.zeros((cpo_disps.shape[0], 1))
padded_disps = np.hstack((base_disps, cpo_disps))
cpo_drifts = np.diff(padded_disps, axis=1)
cpo_isd = np.diff(padded_disps, axis=1)
storey_heights = np.array(self.storey_heights)
cpo_drifts = (cpo_isd / storey_heights) * 100
max_interstorey_drift = np.max(np.abs(cpo_drifts))

ops.wipeAnalysis()
Expand Down
41 changes: 18 additions & 23 deletions openquake/vmtk/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ def animate_cpo(self,
ax_curve.tick_params(labelsize=_FS)

# Governing Drift Hysteresis (Base Shear vs MIDR)
ax_drift.set_xlabel('Maximum Interstorey Drift [-]', fontsize=_FS)
ax_drift.set_xlabel('Maximum Interstorey Drift [%]', fontsize=_FS)
ax_drift.set_ylabel('Base Shear [kN]', fontsize=_FS)
ax_drift.set_title('Hysteretic Curve', fontsize=_FS, fontweight='bold')
ax_drift.plot(governing_drift_history, cpo_rxn, 'gray', linewidth=2,
Expand Down Expand Up @@ -1455,10 +1455,10 @@ def plot_demand_profiles(self,
ax.set_xlim([0, 5.0])

# Add title
default_title = "Seismic Demand Profiles"
fig.suptitle(title if title else default_title,
fontsize=self.font_sizes['title'],
fontname=self.font_name)
if title:
fig.suptitle(title,
fontsize=self.font_sizes['title'],
fontname=self.font_name)

# Save or Show
if pFlag:
Expand Down Expand Up @@ -1722,8 +1722,8 @@ def plot_ida_analysis(self,
(min, max) limits for the Y-axis (IML axis).

title : str, optional, default=None
A custom title for the figure. If not provided, a default title
incorporating the Intensity Measure (IM) label is used.
A custom title for the figure. If not provided, no title is
displayed.

pFlag : bool, optional, default=True
If True, the plot is processed (saved/shown).
Expand Down Expand Up @@ -1879,7 +1879,7 @@ def plot_msa_analysis(self,
ylims : tuple of float
(min, max) for the IM (y) axis.
title : str, optional
Figure title. Defaults to a standard MSA title.
Figure title. If not provided, no title is displayed.
pFlag : bool, default True
Show/save the figure when True; close silently when False.
export_path : str, optional
Expand Down Expand Up @@ -2049,8 +2049,7 @@ def plot_fragility_from_mca(self,
``(min, max)`` limits for the Y-axis.

title : str, optional
Custom plot title. If ``None``, a method-specific default
is used.
Custom plot title. If ``None``, no title is displayed.

cloud_method : {'bootstrap', 'classical'} or None, optional
Selects the plotting style. When ``None`` (default), the
Expand Down Expand Up @@ -2138,10 +2137,6 @@ def plot_fragility_from_mca(self,
label=label,
zorder=3)

default_title = (
"Fragility Functions from Modified Cloud Analysis"
" (Bootstrap)")

# -----------------------------------------------------------------
# Classical (Bayesian MCMC) rendering
# -----------------------------------------------------------------
Expand Down Expand Up @@ -2182,10 +2177,6 @@ def plot_fragility_from_mca(self,
label=label,
zorder=3)

default_title = (
"Robust Fragility Functions from Modified Cloud Analysis"
" (Classical / Jalayer et al. 2017)")

else:
raise ValueError(
f"Unknown cloud_method '{cloud_method}'. "
Expand All @@ -2194,10 +2185,11 @@ def plot_fragility_from_mca(self,
# -----------------------------------------------------------------
# Final formatting
# -----------------------------------------------------------------
ax.set_title(
title if title else default_title,
fontsize=self.font_sizes['title'],
fontname=self.font_name)
if title:
ax.set_title(
title,
fontsize=self.font_sizes['title'],
fontname=self.font_name)
ax.set_xlim([xlims[0], xlims[1]])
ax.set_ylim([ylims[0], ylims[1]])
ax.xaxis.set_minor_locator(AutoMinorLocator())
Expand Down Expand Up @@ -2292,6 +2284,7 @@ def plot_fragility_from_ida(self,

self._set_plot_style(
ax,
title=title,
xlabel=imt_label,
ylabel=r'Probability of Exceedance $P(DS \geq ds | IM)$')

Expand Down Expand Up @@ -2401,6 +2394,7 @@ def plot_fragility_from_msa(self,
fig, ax = plt.subplots(figsize=self.figsize, constrained_layout=True)
self._set_plot_style(
ax,
title=title,
xlabel=imt_label,
ylabel=r'Probability of Exceedance $P(DS \geq ds | IM)$')

Expand Down Expand Up @@ -2561,7 +2555,7 @@ def plot_slf_model(self,
ax.legend(fontsize=self.font_sizes['legend'])

self._set_plot_style(ax,
title=title or "Storey Loss Function",
title=title,
xlabel=edp_label,
ylabel=loss_label)

Expand Down Expand Up @@ -2686,6 +2680,7 @@ def plot_vulnerability_function(self,

# Set plot style
self._set_plot_style(ax1,
title=title,
xlabel=imt_label,
ylabel=loss_label)

Expand Down
Loading