Skip to main content

Numerical tool for perfroming uncertainty quantification

Project description

doc/.static/chaospy_logo.svg

circleci codecov pypi readthedocs

Chaospy is a numerical tool for performing uncertainty quantification using polynomial chaos expansions and advanced Monte Carlo methods implemented in Python.

If you are using this software in work that will be published, please cite the journal article: Chaospy: An open source tool for designing methods of uncertainty quantification

Installation

Installation should be straight forward:

pip install chaospy

And you should be ready to go.

Alternatively, to get the most current experimental version, the code can be installed from Github as follows:

git clone git@github.com:jonathf/chaospy.git    # first time only
cd chaospy/
git pull                                        # after the first time
pip install .

Example Usage

chaospy is created to be simple and modular. A simple script to implement point collocation method will look as follows:

import chaospy
import numpy

# your code wrapper goes here
coordinates = numpy.linspace(0, 10, 100)
def foo(coordinates, params):
    """Function to do uncertainty quantification on."""
    return params[0] * numpy.e**(-params[1]*coordinates)

# bi-variate probability distribution
distribution = chaospy.J(chaospy.Uniform(1, 2), chaospy.Uniform(0.1, 0.2))

# polynomial chaos expansion
polynomial_expansion = chaospy.generate_expansion(8, distribution)

# samples:
samples = distribution.sample(1000)

# evaluations:
evals = [foo(coordinates, sample) for sample in samples.T]

# polynomial approximation
foo_approx = chaospy.fit_regression(
    polynomial_expansion, samples, evals)

# statistical metrics
expected = chaospy.E(foo_approx, distribution)
deviation = chaospy.Std(foo_approx, distribution)

For a more extensive description of what going on, see the collection of tutorials.

Development

Development is done using Poetry manager. Inside the repository directory, install and create a virtual environment with:

poetry install

To run tests:

poetry run pytest chaospy/ tests/ doc/ --doctest-modules

To build documentation, run:

cd doc/
make html

The documentation will be generated into the folder doc/.build/html.

Questions and Contributions

Please feel free to file an issue for:

  • bug reporting

  • asking questions related to usage

  • requesting new features

  • wanting to contribute with code

Project details


Release history Release notifications | RSS feed

This version

3.3.1

Download files

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

Source Distribution

chaospy-3.3.1.tar.gz (145.0 kB view details)

Uploaded Source

Built Distribution

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

chaospy-3.3.1-py2.py3-none-any.whl (234.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file chaospy-3.3.1.tar.gz.

File metadata

  • Download URL: chaospy-3.3.1.tar.gz
  • Upload date:
  • Size: 145.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Linux/4.15.0-1067-aws

File hashes

Hashes for chaospy-3.3.1.tar.gz
Algorithm Hash digest
SHA256 7e9858f4fa902cc45cc78d78fcea6b4a83a23beddd60c46241706536227b25cb
MD5 c6f518338a5906dd75d7518ae7650092
BLAKE2b-256 094222a06da84f5e6b7c870616147abd3a8c79375b87a22d7d64a435654f8eed

See more details on using hashes here.

File details

Details for the file chaospy-3.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: chaospy-3.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 234.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Linux/4.15.0-1067-aws

File hashes

Hashes for chaospy-3.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1aa13a36c36fbc442773646e0314c0a3042e5342246900b09af381573d620240
MD5 b0f208dc1d080b9702e72b0808a9377e
BLAKE2b-256 7543c7e0a9caeabc81ec34faa18ec9a830f3cda94051fd7b4bcb03fee22d3944

See more details on using hashes here.

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