3
from distutils.core import setup
5
setup(name='uncertainties', version='1.4.1',
6
author='Eric O. LEBIGOT (EOL)',
7
author_email='eric.lebigot@normalesup.org',
8
url='http://pypi.python.org/pypi/uncertainties/',
11
This software is released under a dual license. (1) The GNU General \
12
Public License version 2. (2) Any other license, as long as it is \
13
obtained from the original author.''',
15
description=('Transparent calculations with uncertainties on the'
16
' quantities involved (aka "error propagation") ;'
17
' calculation of derivatives'),
19
long_description=u'''\
20
``uncertainties`` allows calculations such as (2 +/- 0.1)*2 = 4
21
+/- 0.2 to be performed transparently; much more complex mathematical
22
expressions involving numbers with uncertainty can also be evaluated
25
**Correlations** between expressions are correctly taken into account.
26
``x-x`` is thus exactly zero, for instance (most implementations
27
found on the web yield a non-zero uncertainty for ``x-x``, which is
30
Whatever the complexity of the calculation, the number of steps
31
involved, or the correlations between variables, uncertainties
32
produced by this program are what is predicted by `error propagation
38
from uncertainties import num_with_uncert
39
from uncertainties.umath import * # sin(), etc.
41
# Mathematical operations:
42
x = num_with_uncert((0.20, 0.01)) # x = 0.20+/-0.01
43
x = num_with_uncert("0.20+/-0.01") # Other representation
44
x = num_with_uncert("0.20(1)") # Other representation
45
print x**2 # Square: prints "0.04+/-0.004"
46
print sin(x**2) # Prints "0.0399...+/-0.00399..."
48
print x.position_in_sigmas(0.17) # Prints "-3.0": deviation of -3 sigmas
50
# Access to the nominal value, and to the uncertainty:
51
square = x**2 # Square
52
print square # Prints "0.04+/-0.004"
53
print square.nominal_value # Prints "0.04"
54
print square.std_dev() # Prints "0.004..."
56
print square.derivatives[x] # Partial derivative: prints "0.4" (= 2*0.20)
58
print square - x*x # Exactly zero: correlations taken into account
60
The Python_ (or IPython_) shell can thus be used as **a powerful
61
calculator** that handles quantities with uncertainties (``print``
62
statements are optional, which is convenient).
64
**Almost all mathematical operations** are supported, including most
65
functions from the standard math_ module (sin,...) and functions from the
66
third-party NumPy_ module (fast operations on arrays and matrices).
67
Comparison operators (``>``, ``==``, etc.) are supported too. There is
68
no restriction on the complexity of mathematical expressions, or on the
69
number of variables involved (x-sin(x)+y**2-tan(y*x) can for example be
70
calculated, whether x and y are quantities with uncertainties or not).
72
Another possible use of this module is the calculation of **partial
73
derivatives** of mathematical functions (they are used by `error
74
propagation theory`_, and are thus automatically calculated by this
77
Additional examples and information can be obtained with ``pydoc
78
uncertainties`` and ``pydoc uncertainties.umath`` after installation.
80
*Installation*: ``sudo easy_install uncertainties`` might be
81
sufficient, depending on your installation (this does not require any
82
manual download, but requires setuptools_). For additional
83
installation methods, download the source archive, and see the
84
``README.txt`` file that it contains.
88
- "*A gift of the gods for the work I\'m doing*" (e-mail)
89
- "*Holy f\*\*\* this would have saved me so much f\*\*\*ing time last\
91
- "*Very useful*" (reddit_)
93
Please send feature requests, bug reports, or feedback to
94
`Eric O. LEBIGOT (EOL)`_.
96
*Version history* (main changes only):
98
- 1.4: added three utilities for manipulating NumPy arrays of numbers with\
99
uncertainty (see the main package documentation).
100
- 1.3: numbers with uncertainty are now constructed with \
101
``num_with_uncert()``, which replaces ``NumberWithUncert()``. This \
102
simplifies the class hierarchy by removing the ``NumberWithUncert`` class.
103
- 1.2.5: numbers with uncertainty can now be entered as \
104
``NumberWithUncert("1.23+/-0.45")`` too.
105
- 1.2.3: ``log(x, base)`` is now supported by ``umath.log()``, in addition \
107
- 1.2.2: values with uncertainties are now output like 3+/-1, in order \
108
to avoid confusing 3+-1 with 3+(-1).
109
- 1.2: a new function, ``wrap()``, is exposed, which allows non-Python \
110
functions (e.g. Fortran or C used through a module such as SciPy) to \
111
handle numbers with uncertainty.
112
- 1.1: mathematical functions (such as cosine, etc.) are in a new \
113
uncertainties.umath module; \
114
they do not override functions from the math module anymore.
115
- 1.0.12: main class (``Number_with_uncert``) renamed ``NumberWithUncert`` \
116
so as to follow `PEP 8`_.
117
- 1.0.11: ``origin_value`` renamed more appropriately as \
119
- 1.0.9: ``correlations()`` renamed more appropriately as \
120
``covariance_matrix()``.
122
.. _Python: http://docs.python.org/tutorial/interpreter.html
123
.. _IPython: http://ipython.scipy.org/
124
.. _NumPy: http://numpy.scipy.org/
125
.. _math: http://docs.python.org/library/math.html
126
.. _PEP 8: http://www.python.org/dev/peps/pep-0008/
127
.. _error propagation theory: http://en.wikipedia.org/wiki/Propagation\
129
.. _setuptools: http://pypi.python.org/pypi/setuptools
130
.. _Eric O. LEBIGOT (EOL): mailto:eric.lebigot@normalesup.org
131
.. _reddit: http://www.reddit.com/r/Python/comments/am84v/\
132
now_you_can_do_calculations_with_uncertainties_5/
135
keywords=['error propagation', 'uncertainties',
136
'uncertainty calculations',
137
'standard deviation',
138
'derivatives', 'partial derivatives', 'differentiation'],
141
'Development Status :: 5 - Production/Stable',
142
'Intended Audience :: Developers',
143
'Intended Audience :: Education',
144
'Intended Audience :: Other Audience',
145
'Intended Audience :: Science/Research',
146
'Operating System :: OS Independent',
147
'Programming Language :: Python',
148
'Programming Language :: Python :: 2.5',
149
'Programming Language :: Python :: 2.6',
150
'Topic :: Scientific/Engineering',
151
'Topic :: Scientific/Engineering :: Mathematics',
152
'Topic :: Scientific/Engineering :: Physics',
153
'Topic :: Software Development',
154
'Topic :: Software Development :: Libraries',
155
'Topic :: Software Development :: Libraries :: Python Modules',
159
# Files are defined in MANIFEST.in
160
packages=['uncertainties']
161
# py_modules=['uncertainties', 'uncertainties.umath']