mcerp
is a stochastic calculator for Monte Carlo methods that uses
latin-hypercube sampling to perform non-order specific
error propagation (or uncertainty analysis).
With this package you can easily and transparently track the effects of uncertainty through mathematical calculations. Advanced mathematical functions, similar to those in the standard math module, and statistical functions like those in the scipy.stats module, can also be evaluated directly.
If you are familiar with Excel-based risk analysis programs like @Risk, Crystal Ball, ModelRisk, etc., this package will work wonders for you (and probably even be faster!) and give you more modelling flexibility with the powerful Python language. This package also doesn't cost a penny, compared to those commercial packages which cost thousands of dollars for a single-seat license. Feel free to copy and redistribute this package as much as you desire!
- Significant speed enhancements in MCERP object creation.
- Updated plotcorr function to display correct plots when
full
-kwarg is set toFalse
(i.e., to display only an upper triangular scatterplot matrix). - Fixed a sign bug when two MCERP are compared with boolean operators >, <, etc.
- Improved boolean operators in general to handle MCERP objects that have
discrete values so that (
H(50, 5, 10)==4
returns a meaningful probability like the <, <=, >, >= operators do.
- Transparent calculations. No or little modification to existing code required.
- Basic NumPy support without modification. (I haven't done extensive testing, so please let me know if you encounter bugs.)
- Advanced mathematical functions supported through the
mcerp.umath
sub-module. If you think a function is in there, it probably is. If it isn't, please request it! - Easy statistical distribution constructors. The location, scale, and shape parameters follow the notation in the respective Wikipedia articles and other relevant web pages.
- Correlation enforcement and variable sample visualization capabilities.
- Probability calculations using conventional comparison operators.
- Advanced Scipy statistical function compatibility with package functions. Depending on your version of Scipy, some functions might not work.
The following packages should be installed automatically (if using pip
or easy_install
), otherwise they will need to be installed manually:
- NumPy : Numeric Python
- SciPy : Scientific Python
- Matplotlib : Python plotting library
These packages come standard in Python(x,y), Spyder, and other scientific computing python bundles.
You have several easy, convenient options to install the mcerp
package (administrative privileges may be required)
Simply copy the unzipped
mcerp-XYZ
directory to any other location that python can find it and rename itmcerp
.From the command-line, do one of the following:
Manually download the package files below, unzip to any directory, and run:
$ [sudo] python setup.py install
If
setuptools
is installed, run:$ [sudo] easy_install [--upgrade] mcerp
If
pip
is installed, run:$ [sudo] pip install [--upgrade] mcerp
To use this package with Python 3.x, you will need to run the 2to3
conversion tool at the command-line using the following syntax while in the
unzipped mcerp
directory:
$ 2to3 -w .
This should take care of the main changes required. Then, run:
$ python3 setup.py install
If bugs continue to pop up, please email the author.
You can also get the bleeding-edge code from GitHub (though I can't promise there won't be stability issues...).
- uncertainties : First-order error propagation
- soerp : Second-order error propagation
Please send feature requests, bug reports, or feedback to Abraham Lee.