Skip to main content

Real-time latin-hypercube-sampling-based Monte Carlo Error Propagation for Python

Project description

mcerp

Real-time latin-hypercube sampling-based Monte Carlo ERror Propagation for Python

Tests Documentation Ruff

codecov Quality Gate Status License

PyPI Downloads Python versions

Overview

mcerp is a stochastic calculator for Monte Carlo methods that uses latin-hypercube sampling to perform non-order specific error propagation (or uncertainty analysis).

With this package you can easily and transparently track the effects of uncertainty through mathematical calculations. Advanced mathematical functions, similar to those in the standard math module, and statistical functions like those in the scipy.stats module, can also be evaluated directly.

If you are familiar with Excel-based risk analysis programs like @Risk, Crystal Ball, ModelRisk, etc., this package will work wonders for you (and probably even be faster!) and give you more modelling flexibility with the powerful Python language. This package also doesn't cost a penny, compared to those commercial packages which cost thousands of dollars for a single-seat license. Feel free to copy and redistribute this package as much as you desire!

  1. Transparent calculations. No or little modification to existing code required.

  2. Basic NumPy support without modification. (I haven't done extensive testing, so please let me know if you encounter bugs.)

  3. Advanced mathematical functions supported through the mcerp.umath sub-module. If you think a function is in there, it probably is. If it isn't, please request it!

  4. Easy statistical distribution constructors. The location, scale, and shape parameters follow the notation in the respective Wikipedia articles and other relevant web pages.

  5. Correlation enforcement and variable sample visualization capabilities.

  6. Probability calculations using conventional comparison operators.

  7. Advanced Scipy statistical function compatibility with package functions. Depending on your version of Scipy, some functions might not work.

Installation

You have several easy, convenient options to install the mcerp package.

pip

pip install mcerp

To install with plotting support:

pip install mcerp[plot]

To install all optional dependencies:

pip install mcerp[all]

uv

uv add mcerp
uv sync

Or in an existing uv environment:

uv pip install mcerp

git

To install the latest version from git:

pip install --upgrade "git+https://github.com/eggzec/mcerp.git#egg=mcerp"

Requirements

  • Python >=3.10
  • NumPy : Numeric Python
  • SciPy : Scientific Python (the nice distribution constructors require this)
  • Matplotlib : Python plotting library (optional)

See Also

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcerp-0.2.0.tar.gz (381.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcerp-0.2.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file mcerp-0.2.0.tar.gz.

File metadata

  • Download URL: mcerp-0.2.0.tar.gz
  • Upload date:
  • Size: 381.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcerp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fca7d0d2b98cbf170779844892c8b862fad9e2c067a4ae042646f1cc7d080453
MD5 bc81bd576eef3841cc269a98d5e0c6c8
BLAKE2b-256 e01de1e481ba5a43a178256e298e3c1c43a1d9458f6ac855c9c7fc071ec2a1e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcerp-0.2.0.tar.gz:

Publisher: publish_dist.yml on eggzec/mcerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcerp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcerp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcerp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78faa63c9b703f7742e735112843638c4f3cfbe238fe0eee62934d46ef95bd55
MD5 841b06c37850cc1b85cc618d385f8645
BLAKE2b-256 0975190408f067a61463b8bec84b931882a4f03598bddaae3a85ba3d030f79f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcerp-0.2.0-py3-none-any.whl:

Publisher: publish_dist.yml on eggzec/mcerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page