Metadata-Version: 2.4
Name: pelicunDLML
Version: 0.1.0rc1
Summary: pelicun and the SimCenter Damage and Loss Model Library merged into one package
Author: PelicunDLML contributors
Maintainer: PelicunDLML contributors
License-Expression: BSD-3-Clause
Project-URL: Upstream pelicun, https://github.com/NHERI-SimCenter/pelicun
Project-URL: Upstream DLML, https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary
Keywords: pelicun,dlml,fema-p-58,hazus,fragility,seismic-loss,natural-hazards
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSES/pelicun-BSD-3-Clause.txt
License-File: LICENSES/simcenter-dlml-BSD-3-Clause.txt
Requires-Dist: numpy<3.0,>=1.23
Requires-Dist: scipy>=1.8.0
Requires-Dist: pandas<3.0,>=2.2.3
Requires-Dist: colorama<0.5.0,>=0.4.0
Requires-Dist: numexpr<3.0,>=2.8
Requires-Dist: jsonschema<5.0,>=4.22.0
Requires-Dist: tqdm<5.0,>=4.60.0
Requires-Dist: joblib<2.0,>=1.2.0
Requires-Dist: scikit-learn<2.0,>=1.0.0
Provides-Extra: explorer
Requires-Dist: streamlit>=1.58.0; extra == "explorer"
Requires-Dist: plotly; extra == "explorer"
Requires-Dist: colorlover; extra == "explorer"
Requires-Dist: qdrant-client[fastembed]>=1.14.0; extra == "explorer"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-xdist; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-socket; extra == "test"
Requires-Dist: glob2; extra == "test"
Provides-Extra: legacy
Requires-Dist: pelicundlml-legacy-pelicun; extra == "legacy"
Requires-Dist: pelicundlml-legacy-dlml; extra == "legacy"
Dynamic: license-file

# pelicunDLML

**pelicun** (Probabilistic Estimation of Losses, Injuries, and Community resilience
Under Natural hazard events) and the **SimCenter Damage and Loss Model Library (DLML)**
merged into one installable package that runs on current NumPy / SciPy / Python.

> Status: **release candidate** (`0.1.0rc1`). Not declared stable yet -- see
> "Known limitations" and `CHANGELOG.md`.

| | |
|---|---|
| Distribution (pip) | `pelicunDLML` |
| Import name | `pelicundlml` |
| pelicun upstream | commit `6708a3b` (v3.10 + 11), see `UPSTREAM.json` |
| DLML upstream | v3.2, commit `869423b` |
| Python | 3.10 - 3.14 (tested) |
| SciPy | 1.15.3, 1.17.1, 1.18.1 (tested); no upper cap |
| License | BSD 3-Clause (upstream notices kept in `LICENSES/`) |

## Why

Upstream pelicun computes multivariate normal box probabilities with the private
Fortran routine `scipy.stats._mvn.mvndst`, which SciPy removed in 1.16. pelicunDLML
replaces it with `pelicundlml.compat.mvn`, a pure NumPy/SciPy implementation of the
same Genz algorithm with the same signature and return values, validated against
the original Fortran routine and against independent references (see
`docs/validation.md`). Everything else is upstream code, changed only by the
mechanical rename described in `PORTING.md`.

## Install

    pip install pelicunDLML            # from PyPI once published
    pip install pelicunDLML-0.1.0rc1-py3-none-any.whl   # from a release file

Optional:

    pip install "pelicunDLML[test]"    # pytest stack to run the test suites
    pip install pelicundlml-legacy-pelicun pelicundlml-legacy-dlml
                                       # old import names `pelicun` and `dlml`

Do not install the legacy name packages next to the original `pelicun` or
`simcenter-dlml`; they use the same import names.

## Use

```python
import pelicundlml
from pelicundlml.assessment import Assessment, DLCalculationAssessment
from pelicundlml import uq, base, file_io
from pelicundlml.dlml import api as dlml          # DLML model data

print(pelicundlml.__version__, pelicundlml.PELICUN_UPSTREAM, pelicundlml.DLML_UPSTREAM)

import pelicundlml.compat
print(pelicundlml.compat.versions())             # versions + MVN backend, for bug reports
```

Command line (same options as upstream `pelicun` and `dlml`):

    pelicundlml --help                  # == python -m pelicundlml
    pelicundlml-dlml --help

Existing scripts written for upstream pelicun only need
`import pelicun` -> `import pelicundlml` (or install the legacy name package).

## Tests

    pip install -e ".[test]"
    python -m pytest pelicundlml/tests tests -n auto

* `pelicundlml/tests` -- upstream pelicun suite (381 tests)
* `tests/dlml` -- upstream DLML suite (422 tests)
* `tests/numerical` -- reference values from the original Fortran MVNDST and the
  original censored fit, plus the independent MVN validation (214 tests)

`PELICUNDLML_MVN_BACKEND=legacy` (SciPy < 1.16 only) switches back to the Fortran
routine for regression comparison.

## Known limitations

* Python 3.15: pandas 2.3.3 and numexpr 2.14.2 have no cp315 wheels yet. Built
  from source the full suite passes (1019 passed, 1 skipped), but 3.15 is not
  declared supported until those wheels exist -- see `docs/python315.md`.
* With the legacy name shim, the unmodified upstream suite passes 380/381; the one
  difference is by design (the install folder is `pelicundlml`, not `pelicun`).
* `compat.mvn` is 2-10x slower per call than the old Fortran routine for small
  dimensions (fixed budget, see `docs/validation.md`).
* `compat.mvn.mvndst` uses a fixed point budget (20 000, the Fortran default was
  2 000) so the censored-fit objective is smooth; results are reproducible
  bit-for-bit, whereas the Fortran routine was not.
* The two upstream issues found during porting (input mutated in place by
  `uq.fit_distribution_to_sample`; non-PSD matrix in `_mvn_scale` at large point
  budgets) are kept as upstream behaviour and listed in `CHANGELOG.md`.

## Credits

All engineering content is the work of the pelicun and DLML authors at Stanford
University and the NHERI SimCenter (University of California). Please cite pelicun
and DLML as their authors request. pelicunDLML is an independent repackaging and is
not endorsed by them.
