Skip to content

Commit

Permalink
Revert "Transition from setup.py to pyproject.toml (#199)"
Browse files Browse the repository at this point in the history
This reverts commit e9b82f0.
  • Loading branch information
newville committed Apr 1, 2024
1 parent aab68cf commit 4f2693f
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 153 deletions.
102 changes: 13 additions & 89 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,101 +13,31 @@ uncertainties
.. image:: https://img.shields.io/github/actions/workflow/status/lmfit/uncertainties/python-package.yml?logo=github%20actions
:target: https://github.com/lmfit/uncertainties/actions/workflows/python-package.yml

``uncertainties`` allows **calculations** such as (2 +/- 0.1)*2 = 4 +/-
0.2 to be **performed transparently**. Much more complex mathematical
expressions involving numbers with uncertainties can also be evaluated
directly.

The ``uncertainties`` package **takes the pain and complexity out**
of uncertainty calculations.

**Detailed information** about this package can be found on its `main
website`_.

Basic examples
--------------

.. code-block:: python
This is the ``uncertainties`` Python package, which performs **transparent
calculations with uncertainties** (aka "error propagation"):

>>> from uncertainties import ufloat
>>> x = ufloat(2, 0.25)
>>> x
2.0+/-0.25
>>> square = x**2 # Transparent calculations
>>> square
4.0+/-1.0
>>> square.nominal_value
4.0
>>> square.std_dev # Standard deviation
1.0
>>> square - x*x
0.0 # Exactly 0: correlations taken into account
>>> from uncertainties.umath import * # sin(), etc.
>>> sin(1+x**2)
-0.95892427466313845+/-0.2836621854632263
>>> print (2*x+1000).derivatives[x] # Automatic calculation of derivatives
2.0
>>> from uncertainties import unumpy # Array manipulation
>>> random_vars = unumpy.uarray([1, 2], [0.1, 0.2])
>>> print random_vars
[1.0+/-0.1 2.0+/-0.2]
>>> print random_vars.mean()
1.50+/-0.11
>>> print unumpy.cos(random_vars)
[0.540302305868+/-0.0841470984808 -0.416146836547+/-0.181859485365]
Main features
-------------
>>> x = ufloat(1, 0.1) # x = 1+/-0.1
>>> print(2*x)
2.00+/-0.20
>>> sin(2*x) # In a Python shell, "print" is optional
0.9092974268256817+/-0.08322936730942848

- **Transparent calculations with uncertainties**: **no or little
modification of existing code** is needed. Similarly, the Python_ (or
IPython_) shell can be used as **a powerful calculator** that
handles quantities with uncertainties (``print`` statements are
optional, which is convenient).

- **Correlations** between expressions are correctly taken into
account. Thus, ``x-x`` is exactly zero, for instance (most
implementations found on the web yield a non-zero uncertainty for
``x-x``, which is incorrect).

- **Almost all mathematical operations** are supported, including most
functions from the standard math_ module (sin,...). Comparison
operators (``>``, ``==``, etc.) are supported too.

- Many **fast operations on arrays and matrices** of numbers with
uncertainties are supported.

- **Extensive support for printing** numbers with uncertainties
(including LaTeX support and pretty-printing).

- Most uncertainty calculations are performed **analytically**.

- This module also gives access to the **derivatives** of any
mathematical expression (they are used by `error
propagation theory`_, and are thus automatically calculated by this
module).


Installation or upgrade
-----------------------

Installation instructions are available on the `main web site
<http://uncertainties-python-package.readthedocs.io/en/latest/index.html#installation-and-download>`_
for this package.
This package also **automatically calculates derivatives of arbitrary functions**:

>>> (2*x+1000).derivatives[x]
2.0

The main documentation is available at
https://uncertainties.readthedocs.io/.

Git branches
------------

The ``release`` branch is the latest stable release. It should pass the tests.


``master*`` branches in the Github repository are bleeding-edge, and do not
necessarily pass the tests. The ``master`` branch is the latest, relatively
stable versions (while other ``master*`` branches are more experimental).
Expand Down Expand Up @@ -137,9 +67,3 @@ History
This package was created back around 2009 by `Eric O. LEBIGOT <https://github.com/lebigot>`_.

Ownership of the package was taken over by the `lmfit GitHub organization <https://github.com/lmfit>`_ in 2024.

.. _Python: http://docs.python.org/tutorial/interpreter.html
.. _IPython: http://ipython.readthedocs.io/en/stable/
.. _math: http://docs.python.org/library/math.html
.. _error propagation theory: http://en.wikipedia.org/wiki/Propagation_of_uncertainty
.. _main website: http://uncertainties-python-package.readthedocs.io/
59 changes: 0 additions & 59 deletions pyproject.toml

This file was deleted.

4 changes: 0 additions & 4 deletions requirements-dev.txt

This file was deleted.

0 comments on commit 4f2693f

Please sign in to comment.