Skip to main content

Numerical tool for perfroming uncertainty quantification

Project description

docs/.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.

Installation

Installation should be straight forward:

pip install chaospy

And you should be ready to go.

Example Usage

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

import numpy
import chaospy

# your code wrapper goes here
coordinates = numpy.linspace(0, 10, 100)
def foo(coordinates, params):
    """Function to do uncertainty quantification on."""
    param_init, param_rate = params
    return param_init*numpy.e**(-param_rate*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 = numpy.array([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 guides on what is going on, see the tutorial collection.

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

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

Project details


Download files

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

Files for chaospy, version 3.3.4
Filename, size File type Python version Upload date Hashes
Filename, size chaospy-3.3.4-py2.py3-none-any.whl (227.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chaospy-3.3.4.tar.gz (139.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page