Skip to content

Chaospy - Toolbox for performing uncertainty quantification.

License

Notifications You must be signed in to change notification settings

rafaelsuchy/chaospy

 
 

Repository files navigation

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 2 and 3.

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 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 [email protected]:jonathf/chaospy.git
cd chaospy
python setup.py install

To install tools for doing development add the extra step:

pip install -r requirements.txt

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
def foo(coord, prm):
    """Function to do uncertainty quantification on."""
    return prm[0] * numpy.e ** (-prm[1] * numpy.linspace(0, 10, 100))

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

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

# samples:
samples = distribution.sample(1000)

# evaluations:
evals = [foo(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 tutorial.

For a collection of recipes, see the cookbook.

Chaospy is being used in other related projects that requires uncertainty quantification components chaospy provides.

easyVVUQ Library designed to facilitate verification, validation and uncertainty quantification.
STARFiSh Shell-based, scientific simulation program for blood flow in mammals.
SurUQ Surrogate modeling with nested uncertainty quantification.
UncertainPy Uncertainty quantification and sensitivity analysis, tailored towards computational neuroscience.

Also a few shout-outs:

OpenTURNS Thanks to Régis Lebrun for both proposing a collaboration and creating an initial implementation of both Chaospy Compatibility in OpenTURNS and OpenTURNS Compatibility in chaospy.
orthopy quadpy Thanks to Nico Schlömer for providing the implementation for several of the quadrature integration methods.
UQRF Thanks to Florian Künzner for providing the implementation for sample distribution.

For any problems and questions you might have related to chaospy, please feel free to file an issue.

About

Chaospy - Toolbox for performing uncertainty quantification.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 86.4%
  • TeX 13.6%