Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/snaeimi/pelicun into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
snaeimi committed Jan 7, 2025
2 parents ec0fd90 + 7199642 commit 54562a0
Show file tree
Hide file tree
Showing 55 changed files with 1,603 additions and 2,327 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and deploy documentation
on:
push:
branches:
- docs
- master
jobs:
build-docs:
runs-on: ${{ matrix.os }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy_to_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -24,5 +26,4 @@ jobs:
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: zsarnoczay
password: ${{ secrets.PELICUN_GITHUB_TOKEN }}
# use trusted publisher, no password needed
4 changes: 2 additions & 2 deletions .github/workflows/docs_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
submodules: true
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
with:
submodules: true
- name: Run codespell
uses: codespell-project/actions-codespell@v2
204 changes: 5 additions & 199 deletions README.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions doc/source/_static/hide_empty_pre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('div.nboutput.docutils.container').forEach(function(div) {
// Our objective is to hide all `div` elements of which all
// children elements only contain whitespace.
// This remedies the nbsphinx issue where an extra newline was
// added to each line in the code block output.
let isEmpty = Array.from(div.children).every(child => !child.textContent.trim());

if (isEmpty) {
div.style.display = 'none';
}
});
});
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
html_static_path = ['_static']

html_css_files = ['css/custom.css']
html_js_files = ['hide_empty_pre.js']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
12 changes: 12 additions & 0 deletions doc/source/developer_guide/development_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Setting up a development environment
We recommend creating a dedicated `virtual environment <https://docs.python.org/3/library/venv.html>`_ for your pelicun development environment.
See also `conda <https://docs.conda.io/en/latest/>`_ and `mamba <https://mamba.readthedocs.io/en/latest/>`_, two widely used programs featuring environment management.

Clone the repository::

git clone --recurse-submodules https://github.com/NHERI-SimCenter/pelicun

Pelicun uses the SimCenter `DamageAndLossModelLibrary <https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary>`_ as a submodule.
In the above, ``recurse-submodules`` ensures that all files of that repository are also obtained.

.. tip::

If you are planning to contribute code, please `fork the repository <https://github.com/NHERI-SimCenter/pelicun/fork>`_ and clone your own fork.


Install pelicun in editable mode with the following command issued from the package's root directory::

python -m pip install -e .[development]
Expand Down
58 changes: 14 additions & 44 deletions doc/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,29 @@ Pelicun examples are listed in the following index.
Increasing the set of examples is a very high priority.
Please come back soon!

Complete list
-------------

+-----------+---------------------------------------------------------+
|Example |Description |
+===========+=========================================================+
|`E1`_ |This example demonstrates the seismic performance |
| |assessment of a steel moment frame structure using the |
| |FEMA P-58 methodology. |
|`E1`_ |Example of a simple assessment involving a single loss |
| |function. The example and associated input files can be |
| |easily extended to include more loss functions and input |
| |demands. |
+-----------+---------------------------------------------------------+
|`E2`_ |Example validating the estimated damage state |
| |probabilities of a single component. |
+-----------+---------------------------------------------------------+
|`E3`_ |A loss assessment combining fragility-based damage |
| |consequences and loss functions. |
+-----------+---------------------------------------------------------+

Grouped by feature
------------------

The following sections group the examples above based on the specific features they illustrate, helping you pick the ones most relevant to what you are looking for.

.. dropdown:: Asset type

+------------------------------------------------------+---------------------------------------------------------+
|Feature |Examples |
+======================================================+=========================================================+
|Building |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+

.. dropdown:: Demand Simulation

+------------------------------------------------------+---------------------------------------------------------+
|Feature |Examples |
+======================================================+=========================================================+
|:ref:`Model calibration <fo_calibration>` |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+
|:ref:`RID|PID inference <fo_pidrid>` |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+
|:ref:`Sample expansion <fo_sample_expansion>` |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+


.. dropdown:: Loss estimation

+------------------------------------------------------+---------------------------------------------------------+
|Feature |Examples |
+======================================================+=========================================================+
|:ref:`Loss maps <fo_loss_maps>` |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+
|:ref:`Active decision variables <fo_active_dvs>` |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+
|:ref:`Loss aggregation <fo_loss_aggregation>` |`E1`_ |
+------------------------------------------------------+---------------------------------------------------------+

.. toctree::
:maxdepth: 1
:hidden:

notebooks/example_1.pct.py
notebooks/example_2.pct.py
notebooks/example_3.pct.py

.. _E1: notebooks/example_1.pct.py
.. _E2: notebooks/example_2.pct.py
.. _E3: notebooks/example_3.pct.py
Loading

0 comments on commit 54562a0

Please sign in to comment.