Name | scinum JSON |
Version |
2.1.2
JSON |
| download |
home_page | None |
Summary | Scientific numbers with multiple uncertainties and correlation-aware, gaussian propagation and Numpy support. |
upload_time | 2024-08-07 11:53:32 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | Copyright (c) 2017-2024, Marcel Rieger All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
scientific
numbers
error
systematics
propagation
|
VCS |
|
bugtrack_url |
|
requirements |
typing_extensions
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<!-- marker-before-logo -->
<p align="center">
<a href="https://github.com/riga/scinum">
<img alt="scinum logo" src="https://media.githubusercontent.com/media/riga/scinum/master/assets/logo250.png" />
</a>
</p>
<!-- marker-after-logo -->
<!-- marker-before-badges -->
<p align="center">
<a href="http://scinum.readthedocs.org/en/latest/?badge=latest">
<img alt="Documentation Status" src="https://readthedocs.org/projects/scinum/badge/?version=latest" />
</a>
<img alt="Python version" src="https://img.shields.io/badge/Python-%E2%89%A53.7-blue" />
<a href="https://pypi.python.org/pypi/scinum">
<img alt="Package Status" src="https://img.shields.io/pypi/v/scinum.svg?style=flat" />
</a>
<a href="https://pypi.python.org/pypi/scinum">
<img alt="PyPI downloads" src="https://img.shields.io/pypi/dm/scinum.svg" />
</a>
<a href="https://github.com/riga/scinum/blob/master/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/riga/scinum.svg" />
</a>
<a href="https://github.com/riga/scinum/actions/workflows/lint_and_test.yml">
<img alt="Lint and test" src="https://github.com/riga/scinum/actions/workflows/lint_and_test.yml/badge.svg" />
</a>
<a href="https://codecov.io/gh/riga/scinum">
<img alt="Cover coverage" src="https://codecov.io/gh/riga/scinum/branch/master/graph/badge.svg?token=bvykpaUaHQ" />
</a>
<a href="https://colab.research.google.com/github/riga/scinum/blob/master/example.ipynb">
<img alt="Example notebook on Colab" src="https://colab.research.google.com/assets/colab-badge.svg" />
</a>
<a href="https://mybinder.org/v2/gh/riga/scinum/master?filepath=example.ipynb">
<img alt="Example notebook on Binder" src="https://mybinder.org/badge_logo.svg" />
</a>
</p>
<!-- marker-after-badges -->
<!-- marker-before-header -->
scinum provides a simple `Number` class that wraps plain floats or [NumPy](http://www.numpy.org/) arrays and adds support for multiple uncertainties, automatic (gaussian) error propagation, and scientific rounding.
**Note**: Support for Python versions 2.7 and 3.6 has been dropped starting from v2.0.0.
Checkout the [legacy/v1.4 branch](https://github.com/riga/scinum/tree/legacy/v1.4) for legacy support.
<!-- marker-after-header -->
<!-- marker-before-body -->
### Usage
The following examples demonstrate the most common use cases.
For more info, see the [API documentation](http://scinum.readthedocs.org/en/latest/?badge=latest) or open the [example.ipynb](https://github.com/riga/scinum/blob/master/example.ipynb) notebook on colab or binder.
[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/riga/scinum/blob/master/example.ipynb) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/riga/scinum/master?filepath=example.ipynb)
###### Number definition
```python
from scinum import Number, UP, DOWN
Number.default_format = "%.2f"
num = Number(5, (2, 1))
print(num) # -> 5.00 +2.00-1.00
# get the nominal value
print(num.nominal) # -> 5.0
print(num.n) # -> 5.0 (shorthand)
print(num()) # -> 5.0 (shorthand)
# get uncertainties
print(num.get_uncertainty()) # -> (2.0, 1.0)
print(num.u()) # -> (2.0, 1.0) (shorthand)
print(num.u(direction=UP)) # -> 2.0
# get shifted values
print(num.get()) # -> 5.0 (no shift)
print(num.get(UP)) # -> 7.0 (up shift)
print(num(UP)) # -> 7.0 (up shift, shorthand)
print(num.get(DOWN)) # -> 4.0 (down shift)
print(num(DOWN)) # -> 4.0 (down shift, shorthand)
```
###### Multiple uncertainties
Use single values to denote symmetric uncertainties, and tuples for asymmetric ones.
Float values refer to absolute values whereas complex numbers (only their imaginary part) define relative effects.
```python
from scinum import Number
num = Number(2.5, {
"sourceA": 0.5, # absolute 0.5, both up and down
"sourceB": (1.0, 1.5), # absolute 1.0 up, 1.5 down
"sourceC": 0.1j, # relative 10%, both up and down
"sourceD": (0.1j, 0.2j), # relative 10% up, relative 20% down
"sourceE": (1.0, 0.2j), # absolute 1.0 up, relative 20% down
"sourceF": (0.3j, 0.3), # relative 30% up, absolute 0.3 down
})
```
###### Correlation handling
When two numbers are combined by means of an operator, the correlation between equally named uncertainties is assumed to be 1.
The example above shows how to configure this correlation coefficient `rho` when used with explicit operator methods defined on a number, such as `num.add()` or `num.mul()`.
However, it is probably more convenient to use `Correlation` objects:
```python
from scinum import Number, Correlation
num = Number(2, 5)
print(num * num) # -> '4.0 +-20.0', fully correlated by default
# same as
# print(num**2)
# print(num.pow(2, inplace=False))
print(num * Correlation(0) * num) # -> '4.0 +-14.14', no correlation
# same as
# print(num.pow(2, rho=0, inplace=False))
```
The correlation object is combined with a number through multiplication, resulting in a `DeferredResult` object.
The deferred result is used to resolve the actual uncertainty combination once it is applied to another number instance which happens in a second step.
Internally, the above example is handled as
```python
deferred = num * Correlation(0)
print(deferred * num)
```
and similarly, adding two numbers without correlation can be expressed as
```python
(num * Correlation(0)) + num
```
When combining numbers with multiple, named uncertainties, correlation coefficients can be controlled per uncertainty by passing names to the `Correlation` constructor.
```python
Correlation(1, sourceA=0) # zero correlation for sourceA, all others default to 1
Correlation(sourceA=0) # zero correlation for sourceA, no default
```
###### Formatting and rounding
`Number.str()` provides some simple formatting tools, including `latex` and `root latex` support, as well as scientific rounding rules:
```python
# output formatting
n = Number(8848, 10)
n.str(unit="m") # -> "8848.0 +-10.0 m"
n.str(unit="m", force_asymmetric=True) # -> "8848.0 +10.0-10.0 m"
n.str(unit="m", scientific=True) # -> "8.848 +-0.01 x 1E3 m"
n.str(unit="m", si=True) # -> "8.848 +-0.01 km"
n.str(style="fancy") # -> "$8848.0 ±10.0$"
n.str(unit="m", style="fancy") # -> "$8848.0 ±10.0\,m$"
n.str(unit="m", style="latex") # -> "$8848.0 \pm 10.0\,m$"
n.str(unit="m", style="latex", si=True) # -> "8.848 \pm 0.01\,km"
n.str(unit="m", style="root") # -> "8848.0 #pm 10.0 m"
n.str(unit="m", style="root", si=True) # -> "8.848 #pm 0.01 km"
# output rounding
n = Number(17.321, {"a": 1.158, "b": 0.453})
n.str() # -> '17.321 +-1.158 (a) +-0.453 (b)'
n.str("%.1f") # -> '17.3 +-1.2 (a) +-0.5 (b)'
n.str("publication") # -> '17.32 +-1.16 (a) +-0.45 (b)'
n.str("pdg") # -> '17.3 +-1.2 (a) +-0.5 (b)'
```
For situations that require more sophisticated rounding and formatting rules, you might want to checkout:
- [`sn.split_value()`](http://scinum.readthedocs.io/en/latest/#split-value)
- [`sn.match_precision()`](http://scinum.readthedocs.io/en/latest/#match-precision)
- [`sn.round_uncertainty()`](http://scinum.readthedocs.io/en/latest/#round-uncertainty)
- [`sn.round_value()`](http://scinum.readthedocs.io/en/latest/#round-value)
- [`sn.infer_si_prefix()`](http://scinum.readthedocs.io/en/latest/#infer-si-prefix)
###### Uncertainty propagation
```python
from scinum import Number
num = Number(5, 1)
print(num + 2) # -> '7.0 +-1.0'
print(num * 3) # -> '15.0 +-3.0'
num2 = Number(2.5, 1.5)
print(num + num2) # -> '7.5 +-2.5'
print(num * num2) # -> '12.5 +-10.0'
# add num2 to num and consider their uncertainties to be fully uncorrelated, i.e. rho = 0
num.add(num2, rho=0)
print(num) # -> '7.5 +-1.80277563773'
```
###### Math operations
As a drop-in replacement for the `math` module, scinum provides an object `ops` that contains math operations that are aware of gaussian error propagation.
```python
from scinum import Number, ops
num = ops.log(Number(5, 2))
print(num) # -> 1.60943791243 +-0.4
num = ops.exp(ops.tan(Number(5, 2)))
print(num) # -> 0.0340299245972 +-0.845839754815
print(num.str("%.2f")) # -> 0.03 +-0.85
```
###### Custom operations
There might be situations where a specific operation is not (yet) contained in the `ops` object.
In this case, you can easily register a new one via:
```python
from scinum import Number, ops
@ops.register
def my_op(x):
return x * 2 + 1
@my_op.derive
def my_op(x):
return 2
num = ops.my_op(Number(5, 2))
print(num) # -> 11.00 (+4.00, -4.00)
```
Please note that there is no need to register *simple* functions like in the particular example above as most of them are just composite operations whose propagation rules (derivatives) are already known.
###### NumPy arrays
```python
from scinum import Number
import numpy as np
num = Number(np.array([3, 4, 5]), 2)
print(num)
# [ 3. 4. 5.]
# + [ 2. 2. 2.]
# - [ 2. 2. 2.]
num = Number(np.array([3, 4, 5]), {
"sourceA": (np.array([0.1, 0.2, 0.3]), 0.5j), # absolute values for up, 50% down
})
print(num)
# [ 3. 4. 5.]
# + sourceA [ 0.1 0.2 0.3]
# - sourceA [ 1.5 2. 2.5]
```
### Installation and dependencies
Via [pip](https://pypi.python.org/pypi/scinum)
```bash
pip install scinum
```
or by simply copying the file into your project.
Numpy is an optional dependency.
### Contributing
If you like to contribute, pull requests are happily accepted.
Just make sure to add a new test cases and run them via:
```bash
> python -m unittest tests
```
##### Testing
In general, tests should be run for all python versions ≥ 3.7.
To run tests in a docker container, do:
```bash
git clone https://github.com/riga/scinum.git
cd scinum
docker run --rm -v `pwd`:/scinum -w /scinum python:3.8 python -m unittest tests
```
### Development
- Source hosted at [GitHub](https://github.com/riga/scinum)
- Report issues, questions, feature requests on [GitHub Issues](https://github.com/riga/scinum/issues)
<!-- marker-after-body -->
Raw data
{
"_id": null,
"home_page": null,
"name": "scinum",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "scientific, numbers, error, systematics, propagation",
"author": null,
"author_email": "Marcel Rieger <marcel.rieger@cern.ch>",
"download_url": "https://files.pythonhosted.org/packages/9c/91/805c25f40745345a6c17371794d9df43cec3a951e3c372a27a91a5dbdfba/scinum-2.1.2.tar.gz",
"platform": null,
"description": "<!-- marker-before-logo -->\n\n<p align=\"center\">\n <a href=\"https://github.com/riga/scinum\">\n <img alt=\"scinum logo\" src=\"https://media.githubusercontent.com/media/riga/scinum/master/assets/logo250.png\" />\n </a>\n</p>\n\n<!-- marker-after-logo -->\n\n<!-- marker-before-badges -->\n\n<p align=\"center\">\n <a href=\"http://scinum.readthedocs.org/en/latest/?badge=latest\">\n <img alt=\"Documentation Status\" src=\"https://readthedocs.org/projects/scinum/badge/?version=latest\" />\n </a>\n <img alt=\"Python version\" src=\"https://img.shields.io/badge/Python-%E2%89%A53.7-blue\" />\n <a href=\"https://pypi.python.org/pypi/scinum\">\n <img alt=\"Package Status\" src=\"https://img.shields.io/pypi/v/scinum.svg?style=flat\" />\n </a>\n <a href=\"https://pypi.python.org/pypi/scinum\">\n <img alt=\"PyPI downloads\" src=\"https://img.shields.io/pypi/dm/scinum.svg\" />\n </a>\n <a href=\"https://github.com/riga/scinum/blob/master/LICENSE\">\n <img alt=\"License\" src=\"https://img.shields.io/github/license/riga/scinum.svg\" />\n </a>\n <a href=\"https://github.com/riga/scinum/actions/workflows/lint_and_test.yml\">\n <img alt=\"Lint and test\" src=\"https://github.com/riga/scinum/actions/workflows/lint_and_test.yml/badge.svg\" />\n </a>\n <a href=\"https://codecov.io/gh/riga/scinum\">\n <img alt=\"Cover coverage\" src=\"https://codecov.io/gh/riga/scinum/branch/master/graph/badge.svg?token=bvykpaUaHQ\" />\n </a>\n <a href=\"https://colab.research.google.com/github/riga/scinum/blob/master/example.ipynb\">\n <img alt=\"Example notebook on Colab\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" />\n </a>\n <a href=\"https://mybinder.org/v2/gh/riga/scinum/master?filepath=example.ipynb\">\n <img alt=\"Example notebook on Binder\" src=\"https://mybinder.org/badge_logo.svg\" />\n </a>\n</p>\n\n<!-- marker-after-badges -->\n\n<!-- marker-before-header -->\n\nscinum provides a simple `Number` class that wraps plain floats or [NumPy](http://www.numpy.org/) arrays and adds support for multiple uncertainties, automatic (gaussian) error propagation, and scientific rounding.\n\n**Note**: Support for Python versions 2.7 and 3.6 has been dropped starting from v2.0.0.\nCheckout the [legacy/v1.4 branch](https://github.com/riga/scinum/tree/legacy/v1.4) for legacy support.\n\n<!-- marker-after-header -->\n\n<!-- marker-before-body -->\n\n### Usage\n\nThe following examples demonstrate the most common use cases.\nFor more info, see the [API documentation](http://scinum.readthedocs.org/en/latest/?badge=latest) or open the [example.ipynb](https://github.com/riga/scinum/blob/master/example.ipynb) notebook on colab or binder.\n\n[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/riga/scinum/blob/master/example.ipynb) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/riga/scinum/master?filepath=example.ipynb)\n\n\n###### Number definition\n\n```python\nfrom scinum import Number, UP, DOWN\n\nNumber.default_format = \"%.2f\"\n\nnum = Number(5, (2, 1))\nprint(num) # -> 5.00 +2.00-1.00\n\n# get the nominal value\nprint(num.nominal) # -> 5.0\nprint(num.n) # -> 5.0 (shorthand)\nprint(num()) # -> 5.0 (shorthand)\n\n# get uncertainties\nprint(num.get_uncertainty()) # -> (2.0, 1.0)\nprint(num.u()) # -> (2.0, 1.0) (shorthand)\nprint(num.u(direction=UP)) # -> 2.0\n\n# get shifted values\nprint(num.get()) # -> 5.0 (no shift)\nprint(num.get(UP)) # -> 7.0 (up shift)\nprint(num(UP)) # -> 7.0 (up shift, shorthand)\nprint(num.get(DOWN)) # -> 4.0 (down shift)\nprint(num(DOWN)) # -> 4.0 (down shift, shorthand)\n```\n\n\n###### Multiple uncertainties\n\nUse single values to denote symmetric uncertainties, and tuples for asymmetric ones.\nFloat values refer to absolute values whereas complex numbers (only their imaginary part) define relative effects.\n\n```python\nfrom scinum import Number\n\nnum = Number(2.5, {\n \"sourceA\": 0.5, # absolute 0.5, both up and down\n \"sourceB\": (1.0, 1.5), # absolute 1.0 up, 1.5 down\n \"sourceC\": 0.1j, # relative 10%, both up and down\n \"sourceD\": (0.1j, 0.2j), # relative 10% up, relative 20% down\n \"sourceE\": (1.0, 0.2j), # absolute 1.0 up, relative 20% down\n \"sourceF\": (0.3j, 0.3), # relative 30% up, absolute 0.3 down\n})\n```\n\n\n###### Correlation handling\n\nWhen two numbers are combined by means of an operator, the correlation between equally named uncertainties is assumed to be 1.\nThe example above shows how to configure this correlation coefficient `rho` when used with explicit operator methods defined on a number, such as `num.add()` or `num.mul()`.\n\nHowever, it is probably more convenient to use `Correlation` objects:\n\n```python\nfrom scinum import Number, Correlation\n\nnum = Number(2, 5)\nprint(num * num) # -> '4.0 +-20.0', fully correlated by default\n# same as\n# print(num**2)\n# print(num.pow(2, inplace=False))\n\nprint(num * Correlation(0) * num) # -> '4.0 +-14.14', no correlation\n# same as\n# print(num.pow(2, rho=0, inplace=False))\n```\n\nThe correlation object is combined with a number through multiplication, resulting in a `DeferredResult` object.\nThe deferred result is used to resolve the actual uncertainty combination once it is applied to another number instance which happens in a second step.\nInternally, the above example is handled as\n\n```python\ndeferred = num * Correlation(0)\nprint(deferred * num)\n```\n\nand similarly, adding two numbers without correlation can be expressed as\n\n```python\n(num * Correlation(0)) + num\n```\n\nWhen combining numbers with multiple, named uncertainties, correlation coefficients can be controlled per uncertainty by passing names to the `Correlation` constructor.\n\n```python\nCorrelation(1, sourceA=0) # zero correlation for sourceA, all others default to 1\nCorrelation(sourceA=0) # zero correlation for sourceA, no default\n```\n\n###### Formatting and rounding\n\n`Number.str()` provides some simple formatting tools, including `latex` and `root latex` support, as well as scientific rounding rules:\n\n```python\n# output formatting\nn = Number(8848, 10)\nn.str(unit=\"m\") # -> \"8848.0 +-10.0 m\"\nn.str(unit=\"m\", force_asymmetric=True) # -> \"8848.0 +10.0-10.0 m\"\nn.str(unit=\"m\", scientific=True) # -> \"8.848 +-0.01 x 1E3 m\"\nn.str(unit=\"m\", si=True) # -> \"8.848 +-0.01 km\"\nn.str(style=\"fancy\") # -> \"$8848.0 \u00b110.0$\"\nn.str(unit=\"m\", style=\"fancy\") # -> \"$8848.0 \u00b110.0\\,m$\"\nn.str(unit=\"m\", style=\"latex\") # -> \"$8848.0 \\pm 10.0\\,m$\"\nn.str(unit=\"m\", style=\"latex\", si=True) # -> \"8.848 \\pm 0.01\\,km\"\nn.str(unit=\"m\", style=\"root\") # -> \"8848.0 #pm 10.0 m\"\nn.str(unit=\"m\", style=\"root\", si=True) # -> \"8.848 #pm 0.01 km\"\n\n# output rounding\nn = Number(17.321, {\"a\": 1.158, \"b\": 0.453})\nn.str() # -> '17.321 +-1.158 (a) +-0.453 (b)'\nn.str(\"%.1f\") # -> '17.3 +-1.2 (a) +-0.5 (b)'\nn.str(\"publication\") # -> '17.32 +-1.16 (a) +-0.45 (b)'\nn.str(\"pdg\") # -> '17.3 +-1.2 (a) +-0.5 (b)'\n```\n\nFor situations that require more sophisticated rounding and formatting rules, you might want to checkout:\n\n- [`sn.split_value()`](http://scinum.readthedocs.io/en/latest/#split-value)\n- [`sn.match_precision()`](http://scinum.readthedocs.io/en/latest/#match-precision)\n- [`sn.round_uncertainty()`](http://scinum.readthedocs.io/en/latest/#round-uncertainty)\n- [`sn.round_value()`](http://scinum.readthedocs.io/en/latest/#round-value)\n- [`sn.infer_si_prefix()`](http://scinum.readthedocs.io/en/latest/#infer-si-prefix)\n\n\n###### Uncertainty propagation\n\n```python\nfrom scinum import Number\n\nnum = Number(5, 1)\nprint(num + 2) # -> '7.0 +-1.0'\nprint(num * 3) # -> '15.0 +-3.0'\n\nnum2 = Number(2.5, 1.5)\nprint(num + num2) # -> '7.5 +-2.5'\nprint(num * num2) # -> '12.5 +-10.0'\n\n# add num2 to num and consider their uncertainties to be fully uncorrelated, i.e. rho = 0\nnum.add(num2, rho=0)\nprint(num) # -> '7.5 +-1.80277563773'\n```\n\n\n###### Math operations\n\nAs a drop-in replacement for the `math` module, scinum provides an object `ops` that contains math operations that are aware of gaussian error propagation.\n\n```python\nfrom scinum import Number, ops\n\nnum = ops.log(Number(5, 2))\nprint(num) # -> 1.60943791243 +-0.4\n\nnum = ops.exp(ops.tan(Number(5, 2)))\nprint(num) # -> 0.0340299245972 +-0.845839754815\nprint(num.str(\"%.2f\")) # -> 0.03 +-0.85\n```\n\n\n###### Custom operations\n\nThere might be situations where a specific operation is not (yet) contained in the `ops` object.\nIn this case, you can easily register a new one via:\n\n```python\nfrom scinum import Number, ops\n\n@ops.register\ndef my_op(x):\n return x * 2 + 1\n\n@my_op.derive\ndef my_op(x):\n return 2\n\nnum = ops.my_op(Number(5, 2))\nprint(num) # -> 11.00 (+4.00, -4.00)\n```\n\nPlease note that there is no need to register *simple* functions like in the particular example above as most of them are just composite operations whose propagation rules (derivatives) are already known.\n\n\n###### NumPy arrays\n\n```python\nfrom scinum import Number\nimport numpy as np\n\nnum = Number(np.array([3, 4, 5]), 2)\nprint(num)\n# [ 3. 4. 5.]\n# + [ 2. 2. 2.]\n# - [ 2. 2. 2.]\n\nnum = Number(np.array([3, 4, 5]), {\n \"sourceA\": (np.array([0.1, 0.2, 0.3]), 0.5j), # absolute values for up, 50% down\n})\nprint(num)\n# [ 3. 4. 5.]\n# + sourceA [ 0.1 0.2 0.3]\n# - sourceA [ 1.5 2. 2.5]\n```\n\n\n### Installation and dependencies\n\nVia [pip](https://pypi.python.org/pypi/scinum)\n\n```bash\npip install scinum\n```\n\nor by simply copying the file into your project.\n\nNumpy is an optional dependency.\n\n\n### Contributing\n\nIf you like to contribute, pull requests are happily accepted.\nJust make sure to add a new test cases and run them via:\n\n```bash\n> python -m unittest tests\n```\n\n\n##### Testing\n\nIn general, tests should be run for all python versions \u2265 3.7.\n\nTo run tests in a docker container, do:\n\n```bash\ngit clone https://github.com/riga/scinum.git\ncd scinum\n\ndocker run --rm -v `pwd`:/scinum -w /scinum python:3.8 python -m unittest tests\n```\n\n\n### Development\n\n- Source hosted at [GitHub](https://github.com/riga/scinum)\n- Report issues, questions, feature requests on [GitHub Issues](https://github.com/riga/scinum/issues)\n\n<!-- marker-after-body -->\n",
"bugtrack_url": null,
"license": "Copyright (c) 2017-2024, Marcel Rieger All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Scientific numbers with multiple uncertainties and correlation-aware, gaussian propagation and Numpy support.",
"version": "2.1.2",
"project_urls": {
"Documentation": "https://scinum.readthedocs.io",
"Homepage": "https://github.com/riga/scinum",
"Repository": "https://github.com/riga/scinum.git"
},
"split_keywords": [
"scientific",
" numbers",
" error",
" systematics",
" propagation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1820862d224503fad93054656c95f37a3a602cdb1e336d982eec3a0362b91deb",
"md5": "5f9ab2af34b6459dfd5fa3e89fe13635",
"sha256": "93e8b4a408a4ec20d1d4df81286fda218efb0040dac3921b930a4c6fb5d87dcb"
},
"downloads": -1,
"filename": "scinum-2.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5f9ab2af34b6459dfd5fa3e89fe13635",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 31569,
"upload_time": "2024-08-07T11:53:31",
"upload_time_iso_8601": "2024-08-07T11:53:31.360359Z",
"url": "https://files.pythonhosted.org/packages/18/20/862d224503fad93054656c95f37a3a602cdb1e336d982eec3a0362b91deb/scinum-2.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9c91805c25f40745345a6c17371794d9df43cec3a951e3c372a27a91a5dbdfba",
"md5": "a21334932c05d66c7798467c4a474a75",
"sha256": "71d78a426cd6d4b4cc5374e0df963acd280b8ed9c9d3d4225018aba6d571b6f0"
},
"downloads": -1,
"filename": "scinum-2.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a21334932c05d66c7798467c4a474a75",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 36091,
"upload_time": "2024-08-07T11:53:32",
"upload_time_iso_8601": "2024-08-07T11:53:32.817033Z",
"url": "https://files.pythonhosted.org/packages/9c/91/805c25f40745345a6c17371794d9df43cec3a951e3c372a27a91a5dbdfba/scinum-2.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-07 11:53:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "riga",
"github_project": "scinum",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "typing_extensions",
"specs": [
[
"~=",
"4.7.0"
]
]
}
],
"lcname": "scinum"
}