Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docs. #84

Merged
merged 7 commits into from
Dec 10, 2024
Merged
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
49 changes: 3 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Detailed documentation of the available methods and their use is available at ht

## Installation

### For users

`pelicun` is available at the [Python Package Index (PyPI)](https://pypi.org/project/pelicun/). You can simply install it using `pip` as follows:

```shell
Expand All @@ -62,51 +60,10 @@ pip install pelicun==2.6.0

Note that 2.6.0 is the last minor version before the v3.0 release. Other earlier versions can be found [here](https://pypi.org/project/pelicun/#history).

### For contributors

Developers are expected to fork and clone this repository, and install their copy in development mode.
Using a virtual environment is highly recommended.

```shell
# Clone the repository:
git clone https://github.com/<user>/pelicun
cd pelicun
# Switch to the appropriate branch, if needed.
# git checkout <branch>

# Install pelicun:
# Note: don't forget to activate the corresponding environment.
python -m pip install -e .[development]

```

Contributions are managed with pull requests.
It is required that contributed code is [PEP 8](https://peps.python.org/pep-0008/) compliant, does not introduce linter warnings and includes sufficient unit tests so as to avoid reducing the current coverage level.

The following lines implement the aforementioned checks.
`flake8`, `pylint` and `pytest` can all be configured for use within an IDE.
```shell

cd <path-to>/pelicun
export PYTHONPATH=$PYTHONPATH:$(pwd)

# Linting with flake8:
flake8 pelicun

# Linting with pylint:
pylint pelicun

# Type checking with mypy:
mypy pelicun --no-namespace-packages

# Running the tests:
python -m pytest pelicun/tests --cov=pelicun --cov-report html
# Open `htmlcov/index.html`in a browser to see coverage results.

```

Feel free to [open an issue](https://github.com/NHERI-SimCenter/pelicun/issues/new/choose) if you encounter problems setting up the provided development environment.
## Documentation and usage examples

The documentation for pelicun can be accessed [here](https://NHERI-SimCenter.github.io/pelicun/).
It includes information for users, instructions for developers and usage examples.

## Changelog

Expand Down
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
Loading