Numerical tool for perfroming uncertainty quantification
Project description
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
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 = chaospy.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.
Questions & Troubleshooting
For any problems and questions you might have related to chaospy, please feel free to file an issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for chaospy-3.2.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df432a8da037f7d69b6639a932856a4fd17ede15b04d205b48405370aa423aec |
|
MD5 | b957d52f46d494a0c11c3849eb4fadb2 |
|
BLAKE2b-256 | 3a1f056563adc6f31610d61f23062d20e49a126917e2c7ffe6094d57afaeb801 |