Skip to main content

Numerical tool for perfroming uncertainty quantification

Project description

https://github.com/jonathf/chaospy/raw/master/docs/.static/chaospy_logo.svg

circleci codecov readthedocs pypi

license python-versions downloads

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

Wrap your code in a function:

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)

Construct a multivariate probability distribution:

distribution = chaospy.J(chaospy.Uniform(1, 2), chaospy.Uniform(0.1, 0.2))

Construct polynomial chaos expansion:

polynomial_expansion = chaospy.generate_expansion(8, distribution)

Generate random samples from for example Halton low-discrepancy sequence:

samples = distribution.sample(1000, rule="halton")

Evaluate function for each sample:

evals = numpy.array([foo(coordinates, sample) for sample in samples.T])

Bring the parts together using point collocation method:

foo_approx = chaospy.fit_regression(
    polynomial_expansion, samples, evals)

Derive statistics from model approximation:

expected = chaospy.E(foo_approx, distribution)
deviation = chaospy.Std(foo_approx, distribution)
sobol_main = chaospy.Sens_m(foo_approx, distribution)
sobol_total = chaospy.Sens_t(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.

And if you use code to deal with stochastic dependencies, please also cite Multivariate Polynomial Chaos Expansions with Dependent Variables.

Project details


Release history Release notifications | RSS feed

This version

4.1.0

Download files

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

Source Distribution

chaospy-4.1.0.tar.gz (145.5 kB view details)

Uploaded Source

Built Distribution

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

chaospy-4.1.0-py2.py3-none-any.whl (233.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: chaospy-4.1.0.tar.gz
  • Upload date:
  • Size: 145.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.3 Linux/4.15.0-1077-aws

File hashes

Hashes for chaospy-4.1.0.tar.gz
Algorithm Hash digest
SHA256 9abfa8fcab775c19c72a92f2b516ca2da695c34413d5fa9813ad4b225105cc39
MD5 089aff090c2be0f6d43f761cb8b38e6c
BLAKE2b-256 1020d8a99759f2a9ddf65cbfb79a51b442f54fb92f93fc7ffe765e6b0bc8e055

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chaospy-4.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 233.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.3 Linux/4.15.0-1077-aws

File hashes

Hashes for chaospy-4.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2f3a967302c62b7a749f8835bc798a8958afdad24ef1b0d049f358ff669bcdc9
MD5 0f9ded05f923af290a42caff3e67c797
BLAKE2b-256 53b6241675baabd5e4b532758a952575cf64091a453d905249f1d62477bce83a

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