Skip to main content

python codecov

Uncertainty-Value

Simple python class to evaluate the uncertainty for complex or very long calculations given the initial values together with its uncertainty.

How-To

The way it works is simple, first import the script as

from uncvalue import *

then initialise your Value variables (numbers, lists, matrices...) as

pi = Value(3.14159, 0.00011) # number variable 3.14159 +/- 0.00011
A = np.array([pi, Value(2.718, 0.036), Value(1.61803398875, 29e-11)]) # numpy array with 3 elements
M = Value(np.random.rand(3,5), np.random.rand(3,5)*0.056) # 3x5 matrix
  • pi is just a number variable with uncertainty
  • A is a list of values, each one with each own uncertainty
  • M is a 3x5 value matrix (not a matrix of values) where the uncertainty is separated from the value, so this class only works as a container for keeping them together but some operations will not work properly (like multiplication). To initialize the matrix of values correctly we should do it as the list (an example of this is inside test.py).

Perform any operation you want between Value(s):

  • Binary operators: +, -, *, /, **
  • Unary operators (all with numpy): abs, exp, log, sqrt, sin(h), cos(h), tan(h), arcsin(h), arccos(h), arctan(h)
  • Comparison: >=, >, =, <, <=

It's important that, for the unary operators, you use numpy as your base class for math. Operations made with the built-in math python library will result in terrible errors that for sure will end up destroying our and other universes.

For more examples take a look at test.py.

Contributors

License

  Copyright 2020 Physics-Simulations

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

Metadata

Release files for uncvalue 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uncvalue 0.1.1
File Size Uploaded
uncvalue-0.1.1.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uncvalue 0.1.1
File Interpreter ABI Platform
uncvalue-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / uncvalue-0.1.1.tar.gz

Download URL uncvalue-0.1.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2916deb62c9ab536513b4578fe2483c20ae99272764cce7092efa6d35838c95c
BLAKE2b-256 checksum
How to use checksums
1cf2da661f47edbb8ed7d9b1a18728a236f040723453eeb8f2b84a1bb21c91b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / uncvalue-0.1.1-py3-none-any.whl

Download URL uncvalue-0.1.1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdcde647acd8ec812056cd4f0e475f58a32beb1208dfc5125c61477d92863523
BLAKE2b-256 checksum
How to use checksums
0e04ef92067eede13c6238ce6be5a8652933c03d1c6b1884ee10312de7bf5e89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page