Skip to main content

No project description provided

Project description

travis codecov pypi readthedocs

logo

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

A article in Elsevier Journal of Computational Science has been published introducing the software: here. If you are using this software in work that will be published, please cite this paper.

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
cd chaospy
pip install -r requirements.txt
python setup.py install

The last command might need sudo prefix, depending on your python setup.

Optionally, to support more regression methods, install the Scikit-learn package:

pip install scikit-learn

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 = 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.

Questions & Troubleshooting

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

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.0.7
Filename, size File type Python version Upload date Hashes
Filename, size chaospy-3.0.7-py2.py3-none-any.whl (319.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chaospy-3.0.7.tar.gz (155.7 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