|
1 | | -#!/usr/bin/env python |
2 | | -# -*- coding: utf-8 -*- |
3 | | - |
4 | | -import os |
5 | | -import sys |
6 | | - |
7 | | -# Common options for distutils/setuptools's setup(): |
8 | | -setup_options = dict( |
9 | | - name='uncertainties', |
10 | | - version='3.1.7', |
11 | | - author='Eric O. LEBIGOT (EOL)', |
12 | | - author_email='eric.lebigot@normalesup.org', |
13 | | - url='http://uncertainties-python-package.readthedocs.io/', |
14 | | - license='Revised BSD License', |
15 | | - description=('Transparent calculations with uncertainties on the' |
16 | | - ' quantities involved (aka error propagation);' |
17 | | - ' fast calculation of derivatives'), |
18 | | - long_description='''\ |
19 | | -Overview |
20 | | -======== |
21 | | -
|
22 | | -``uncertainties`` allows **calculations** such as (2 +/- 0.1)*2 = 4 +/- |
23 | | -0.2 to be **performed transparently**. Much more complex mathematical |
24 | | -expressions involving numbers with uncertainties can also be evaluated |
25 | | -directly. |
26 | | -
|
27 | | -The ``uncertainties`` package **takes the pain and complexity out** |
28 | | -of uncertainty calculations. |
29 | | -
|
30 | | -**Detailed information** about this package can be found on its `main |
31 | | -website`_. |
32 | | -
|
33 | | -Basic examples |
34 | | -============== |
35 | | -
|
36 | | -.. code-block:: python |
37 | | -
|
38 | | - >>> from uncertainties import ufloat |
39 | | -
|
40 | | - >>> x = ufloat(2, 0.25) |
41 | | - >>> x |
42 | | - 2.0+/-0.25 |
43 | | -
|
44 | | - >>> square = x**2 # Transparent calculations |
45 | | - >>> square |
46 | | - 4.0+/-1.0 |
47 | | - >>> square.nominal_value |
48 | | - 4.0 |
49 | | - >>> square.std_dev # Standard deviation |
50 | | - 1.0 |
51 | | -
|
52 | | - >>> square - x*x |
53 | | - 0.0 # Exactly 0: correlations taken into account |
54 | | -
|
55 | | - >>> from uncertainties.umath import * # sin(), etc. |
56 | | - >>> sin(1+x**2) |
57 | | - -0.95892427466313845+/-0.2836621854632263 |
58 | | -
|
59 | | - >>> print (2*x+1000).derivatives[x] # Automatic calculation of derivatives |
60 | | - 2.0 |
61 | | -
|
62 | | - >>> from uncertainties import unumpy # Array manipulation |
63 | | - >>> random_vars = unumpy.uarray([1, 2], [0.1, 0.2]) |
64 | | - >>> print random_vars |
65 | | - [1.0+/-0.1 2.0+/-0.2] |
66 | | - >>> print random_vars.mean() |
67 | | - 1.50+/-0.11 |
68 | | - >>> print unumpy.cos(random_vars) |
69 | | - [0.540302305868+/-0.0841470984808 -0.416146836547+/-0.181859485365] |
70 | | -
|
71 | | -Main features |
72 | | -============= |
73 | | -
|
74 | | -- **Transparent calculations with uncertainties**: **no or little |
75 | | - modification of existing code** is needed. Similarly, the Python_ (or |
76 | | - IPython_) shell can be used as **a powerful calculator** that |
77 | | - handles quantities with uncertainties (``print`` statements are |
78 | | - optional, which is convenient). |
79 | | -
|
80 | | -- **Correlations** between expressions are correctly taken into |
81 | | - account. Thus, ``x-x`` is exactly zero, for instance (most |
82 | | - implementations found on the web yield a non-zero uncertainty for |
83 | | - ``x-x``, which is incorrect). |
84 | | -
|
85 | | -- **Almost all mathematical operations** are supported, including most |
86 | | - functions from the standard math_ module (sin,...). Comparison |
87 | | - operators (``>``, ``==``, etc.) are supported too. |
88 | | -
|
89 | | -- Many **fast operations on arrays and matrices** of numbers with |
90 | | - uncertainties are supported. |
91 | | -
|
92 | | -- **Extensive support for printing** numbers with uncertainties |
93 | | - (including LaTeX support and pretty-printing). |
94 | | -
|
95 | | -- Most uncertainty calculations are performed **analytically**. |
96 | | -
|
97 | | -- This module also gives access to the **derivatives** of any |
98 | | - mathematical expression (they are used by error |
99 | | - propagation theory, and are thus automatically calculated by this |
100 | | - module). |
101 | | -
|
102 | | -
|
103 | | -Installation or upgrade |
104 | | -======================= |
105 | | -
|
106 | | -Installation instructions are available on the `main web site |
107 | | -<http://uncertainties-python-package.readthedocs.io/en/latest/index.html#installation-and-download>`_ |
108 | | -for this package. |
109 | | -
|
110 | | -Contact |
111 | | -======= |
112 | | -
|
113 | | -Please send **feature requests, bug reports, or feedback** to |
114 | | -`Eric O. LEBIGOT (EOL)`_. |
115 | | -
|
116 | 1 | Version history |
117 | 2 | =============== |
118 | 3 |
|
|
247 | 132 | - 1.0.9: ``correlations()`` renamed more appropriately as |
248 | 133 | ``covariance_matrix()``. |
249 | 134 |
|
250 | | -.. _Python: http://docs.python.org/tutorial/interpreter.html |
251 | | -.. _IPython: http://ipython.readthedocs.io/en/stable/ |
252 | | -.. _NumPy: http://numpy.scipy.org/ |
253 | 135 | .. _math: http://docs.python.org/library/math.html |
254 | 136 | .. _PEP 8: http://www.python.org/dev/peps/pep-0008/ |
255 | | -.. _error propagation theory: http://en.wikipedia.org/wiki/Propagation_of_uncertainty |
256 | | -.. _Eric O. LEBIGOT (EOL): mailto:eric.lebigot@normalesup.org |
257 | | -.. _PayPal: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4TK7KNDTEDT4S |
258 | | -.. _main website: http://uncertainties-python-package.readthedocs.io/ |
259 | 137 | .. _code updater: http://uncertainties-python-package.readthedocs.io/en/latest/index.html#migration-from-version-1-to-version-2 |
260 | | -.. _formatting: http://uncertainties-python-package.readthedocs.io/en/latest/user_guide.html#printing''', |
261 | | - classifiers=[ |
262 | | - 'Development Status :: 5 - Production/Stable', |
263 | | - 'Intended Audience :: Developers', |
264 | | - 'Intended Audience :: Education', |
265 | | - 'Intended Audience :: Other Audience', |
266 | | - 'Intended Audience :: Science/Research', |
267 | | - 'License :: OSI Approved :: BSD License', |
268 | | - 'Operating System :: OS Independent', |
269 | | - 'Programming Language :: Python', |
270 | | - 'Programming Language :: Python :: 3', |
271 | | - 'Programming Language :: Python :: 3.8', |
272 | | - 'Programming Language :: Python :: 3.9', |
273 | | - 'Programming Language :: Python :: 3.10', |
274 | | - 'Programming Language :: Python :: 3.11', |
275 | | - 'Programming Language :: Python :: 3.12', |
276 | | - 'Programming Language :: Python :: Implementation :: Jython', |
277 | | - 'Programming Language :: Python :: Implementation :: PyPy', |
278 | | - 'Topic :: Education', |
279 | | - 'Topic :: Scientific/Engineering', |
280 | | - 'Topic :: Scientific/Engineering :: Mathematics', |
281 | | - 'Topic :: Scientific/Engineering :: Physics', |
282 | | - 'Topic :: Software Development', |
283 | | - 'Topic :: Software Development :: Libraries', |
284 | | - 'Topic :: Software Development :: Libraries :: Python Modules', |
285 | | - 'Topic :: Utilities' |
286 | | - ], |
287 | | - |
288 | | - keywords=[ |
289 | | - 'error propagation', 'uncertainties', 'uncertainty calculations', |
290 | | - 'standard deviation', 'derivatives', 'partial derivatives', |
291 | | - 'differentiation' |
292 | | - ], |
293 | | - |
294 | | - # Files are defined in MANIFEST (which is automatically created by |
295 | | - # python setup.py sdist bdist_wheel): |
296 | | - packages=[ |
297 | | - 'uncertainties', 'uncertainties.unumpy', 'uncertainties.lib1to2', |
298 | | - 'uncertainties.lib1to2.fixes' |
299 | | - ], |
300 | | - |
301 | | - # The code runs with both Python 2 and Python 3: |
302 | | - options={"bdist_wheel": {"universal": True}} |
303 | | - ) |
304 | | - |
305 | | -# The best available setup() is used (some users do not have |
306 | | -# setuptools): |
307 | | -try: |
308 | | - from setuptools import setup |
309 | | - |
310 | | - # Some setuptools-specific options can be added: |
311 | | - |
312 | | - addtl_setup_options = dict( |
313 | | - |
314 | | - project_urls={ |
315 | | - 'Documentation': |
316 | | - 'https://uncertainties-python-package.readthedocs.io/', |
317 | | - 'Source': 'https://github.com/lebigot/uncertainties' |
318 | | - }, |
319 | | - |
320 | | - install_requires=['future'], |
321 | | - |
322 | | - tests_require=['nose', 'numpy'], |
323 | | - |
324 | | - # Optional dependencies install using: |
325 | | - # `easy_install uncertainties[optional]` |
326 | | - extras_require={ |
327 | | - 'optional': ['numpy'], |
328 | | - 'docs': ['sphinx'], |
329 | | - } |
330 | | - ) |
331 | | - |
332 | | - # easy_install uncertainties[tests] option: |
333 | | - addtl_setup_options['extras_require']['tests'] = ( |
334 | | - addtl_setup_options['tests_require']) |
335 | | - |
336 | | - # easy_install uncertainties[all] option: all dependencies are |
337 | | - # gathered |
338 | | - addtl_setup_options['extras_require']['all'] = set( |
339 | | - sum(addtl_setup_options['extras_require'].values(), [])) |
340 | | - |
341 | | - setup_options.update(addtl_setup_options) |
342 | | - |
343 | | -except ImportError: |
344 | | - from distutils.core import setup |
345 | | - |
346 | | -# End of setup definition |
| 138 | +.. _formatting: http://uncertainties-python-package.readthedocs.io/en/latest/user_guide.html#printing |
347 | 139 |
|
348 | | -setup(**setup_options) |
0 commit comments