Skip to main content

A python & numpy data type for floating point numbers with quantified uncertainity.

Project description

Code CI Docs CI Test Coverage Latest PyPI version Apache License

This package provides a python and numpy data type (uncertain) which implements a floating point value with quantified uncertainity, allowing for forward uncertainity propagation of uncorrelated values.

PyPI

pip install numcertain

Source code

https://github.com/DiamondLightSource/numcertain

Documentation

https://DiamondLightSource.github.io/numcertain

Releases

https://github.com/DiamondLightSource/numcertain/releases

Aritmatic Examples

A brief example of arithmatic with the provided uncertain data type is presented below:

a = uncertain(42.0, 5.0)
b = uncertain(36, 12)

print(a + b)
print(a - b)
print(a * b)
print(a / b)
>> 78.0±13.0
>> 6.0±13.0
>> 1512.0±535.1784749034662
>> 1.1666666666666667±0.41294635409218067

A brief example of arithmatic with numpy arrays with the uncertain dtype is presented below:

a = array([uncertain(5.0, 3.0), uncertain(7.0, 6.0)])
b = array([uncertain(12.0, 4.0), uncertain(24.0, 8.0)])

print(a + b)
print(a - b)
print(a * b)
print(a / b)
>> [uncertain(17.0, 5.0) uncertain(31.0, 10.0)]
>> [uncertain(-7.0, 5.0) uncertain(-17.0, 10.0)]
>> [uncertain(60.0, 41.182520563948) uncertain(168.0, 154.50566332662373)]
>> [uncertain(0.4166666666666667, 0.2859897261385278) uncertain(0.2916666666666667, 0.268238998830944)]

Alternative Methods

In order to accurately propagate uncertainties of related values the derivative of the computed expectation must be known with respect to expectations it is comprised of. Automatic differentiation (autodiff) provides a mechanism for computing the derivative of arbitrary functions with respect to their components by exploiting the fact that all codes, regardless of complexity, are reduced to a sequence of primative arithmetic operations during execution for which the derivatives are known, by applying the chain rule the overall derivative can be determined automatically.

The python package Uncertainties provides a python data type which performs autodiff to propagate the corresponding uncertainity, unforunately due to Implementation as a python object the library is non-performant when used for array math.

Whilst Propagation of Uncertainty with autodiff, describes the use of autodiff provided by the python package JAX in propagating uncertainities for array math.

See https://DiamondLightSource.github.io/numcertain for more detailed documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numcertain-0.3.0.tar.gz (48.2 kB view details)

Uploaded Source

Built Distributions

numcertain-0.3.0-cp311-cp311-win_amd64.whl (21.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

numcertain-0.3.0-cp311-cp311-win32.whl (21.0 kB view details)

Uploaded CPython 3.11 Windows x86

numcertain-0.3.0-cp311-cp311-musllinux_1_1_x86_64.whl (63.2 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

numcertain-0.3.0-cp311-cp311-musllinux_1_1_i686.whl (60.4 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

numcertain-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

numcertain-0.3.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (51.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

numcertain-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl (20.3 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

numcertain-0.3.0-cp310-cp310-win_amd64.whl (21.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

numcertain-0.3.0-cp310-cp310-win32.whl (21.0 kB view details)

Uploaded CPython 3.10 Windows x86

numcertain-0.3.0-cp310-cp310-musllinux_1_1_x86_64.whl (62.5 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

numcertain-0.3.0-cp310-cp310-musllinux_1_1_i686.whl (59.6 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

numcertain-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

numcertain-0.3.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (50.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

numcertain-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl (20.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

numcertain-0.3.0-cp39-cp39-win_amd64.whl (21.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

numcertain-0.3.0-cp39-cp39-win32.whl (21.0 kB view details)

Uploaded CPython 3.9 Windows x86

numcertain-0.3.0-cp39-cp39-musllinux_1_1_x86_64.whl (62.0 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

numcertain-0.3.0-cp39-cp39-musllinux_1_1_i686.whl (58.9 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

numcertain-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (54.8 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

numcertain-0.3.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (50.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

numcertain-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl (20.3 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file numcertain-0.3.0.tar.gz.

File metadata

  • Download URL: numcertain-0.3.0.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for numcertain-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2df04d884c2bc95e7aeecf59e246dbcd7d7e061bcef25339f262311b206db966
MD5 5eb47e476f65eac480d7641ec597e148
BLAKE2b-256 2b5789e6932a943459a426e3ec12f05ba55dfa5a974f041e98a7089f55f1439d

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 46e92b4012146abdc8064d890119758754024006604f5214125031e35a84c5b9
MD5 2355827e916e96dc7944594db98b31b2
BLAKE2b-256 14db31a953b0ffb9c6dc1a2d4e7554637794269e2240d6b69af145079c2734b9

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: numcertain-0.3.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 64c765ce4976b771844d9ca7dbd32b72f904637427cf34a004ffe90a8abb7dee
MD5 2f052e1c795c827a08ccaee89f8f1e3b
BLAKE2b-256 99be30bcf621887cbaf073badf1e2966cc28dd95fe1c4eb022d6129e72f51165

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ff350aad6758f460772fce09fe767c3d1b9b0b0f53867a4d17009e3fe253adb6
MD5 75b5f17a315da1f575af2860ce0a832e
BLAKE2b-256 cbfb55983a80387598195d846116006303ff9085bb3cdd2255ddd5812a55dc62

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 b55e0bc399dd5171dd06325478de6383e861f115abc8474de79c7ca859c8a713
MD5 628de226ace3f88c111c261f70d06b4e
BLAKE2b-256 feda6c25fc1d2e100bc1e76a80e34af4a22970c8dc9f38f11e003c099f5cf4d8

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd02dccb1bea83338908db740b4b9c784bb87fd8435f50f4e5be1379c18ac027
MD5 02e3683bbdc40bb538e8729ddc1de44d
BLAKE2b-256 48f16be37bbfa9deb0e76831e21a9debafeb0d2f8b03cca67f384cd1042ce4f2

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 47a0d9860b562c48165b7802496b9c86585cf40fa0f245863c99a4fe601c1d19
MD5 eb0a0e5183eb4dfe3716adb41569f0ed
BLAKE2b-256 6f6c6571fc5e4acf16cb5f8643d93122a15e1f80f7abde7fe694b5f7df4e9f2f

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 41f44d2e967e0f91e19c85aa43c1bf92559bb980f0a454228af45a08abe609a0
MD5 6698716b06a61b080b06ae24f83e7b39
BLAKE2b-256 4fbaa4bb654f4bd28d8faf83602d238ab016da1b519e9637702b9e0786deac9f

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5317b6089a6eff8bf2a355738424458f9700312bea55a9dbea89d93912ba4142
MD5 b593bfb31e91c6412ef087c574f3e07d
BLAKE2b-256 f9ce3221fadb5c36daa582a7f2dea676dff46d59fe1d4603467ba625da50981e

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-win32.whl.

File metadata

  • Download URL: numcertain-0.3.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 ebdf8e5c4984b25cda92adb1e39ac52dcacb30271f585effc25ac6a08d134927
MD5 10ab112625bf318ff1f00a7ad7721424
BLAKE2b-256 e68c124356d868548ba55bbc1bbf8e0342612c0e9bcf2ee102f606bdda64c231

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 8c49f5bbb5020fe8bf91e2195f0f496aec109caeea30cc16ebd6b732a6bad52a
MD5 5242e65bccf857a21fd5883b34bc7e3d
BLAKE2b-256 fc03b6b9e900b04da89f8e0b5802bb2948669e5798c975a7e83cd22f94f0d78f

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 d740027844c1af813120565b13e43f9d51f8f340465eaac19b890431d58ca7df
MD5 4795517d26830a11d9b4b05254f75e48
BLAKE2b-256 c623d0684a928702eb24f5e0c4a777f884348d9512d5d7848dc67048c8437705

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99c3c349dc824f8e93af123b0937fddde453ce105b8f24099e6c017d60797fbd
MD5 7170d5f3a586daf3aa7c7c02bd3208b7
BLAKE2b-256 e6e5eb3511cff405afeeea47c34941b4fcc77877269f7186ec6cd82e58876397

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 c61ab7477efb1c9a944e2244efd532cec7111e9935bc329db489818fcd8fe95a
MD5 161e36a0e4d9e4e7c25ba1700ae28b07
BLAKE2b-256 f0fb07e5cd2243d08e2491b1c338544db7fe86aa4f83dc245e89cf54c40d6426

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3febd980e018671b5f98fe96497cee1a86db15d50aefeb7c0d069d9cd1c5a2fd
MD5 e709a4b962bb79fd28cf177472e43799
BLAKE2b-256 1747a894db5a0c5852034d6f48c14c919ed00cbc50d403d1bc02e3191eff5f83

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2e61e6cbbb67fbde009a4992766fd08c827e062e3c01c385df06a59bdd405d2d
MD5 3644b168a354fdb13e3a5b8f9e975ab3
BLAKE2b-256 bec2d09ad974f94edb9e11daae261af8c5d9e888ad5bdc023285494a2009a4e4

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-win32.whl.

File metadata

  • Download URL: numcertain-0.3.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 c8d53e258814949cf564e5aeac6455061faa729d680eee1e84aa715c9183b6ec
MD5 0e8218515fdc52e2b8f760a32eca3e6e
BLAKE2b-256 22ab2dca5a5ef28d6264d31c1cb0a456f27e75d3e47f07f38c04a0d2269de7e3

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 74e3c48512fdb4384ac45d61ceaddeceef493891f08356ddc6008ab9dded6e30
MD5 4a98fe5fe61589fdaa90731bf9c7fd85
BLAKE2b-256 d203d45e7c37b913121f6db29fdbd189fb832c69a17fa9b851c2852693ff46f5

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 034fa85d3db1aa0847daee6a154a8710ad18795ea8684ebfb9f4bfa07aa510d9
MD5 5a6a842060cf6afe2757d0b6a798f46b
BLAKE2b-256 ed567ab75f8ca8b263ab6c6dc6c0234c105fb552986dfc7b510599a0d547861a

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 631e0b48d35aa2af626fd8dfc3156d01d9a2136e88352fccb60aa95d0cf22149
MD5 a618433ddcd0a9452cb0b3aeb278816d
BLAKE2b-256 8b7cfdf34020e31d11d4f3484e31c28d6e9cd0ab3d3307f2d78675e9f2db2a51

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 20032bb75ee1927f8666a13917dfda0175bc6eb1c1391899f87058ee19960079
MD5 b7d46d9c54af8c280799de7fd28d84e3
BLAKE2b-256 af7e90a350e94923e84f2a8f6c7637a2672619aef7ffba83b84cc6d1b75ace96

See more details on using hashes here.

File details

Details for the file numcertain-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for numcertain-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 953268868a721bb636d1b83b584317ee2ec3e1befddeb11b5316c950c09ccc36
MD5 3953bfc784a62f0fbef01af68b8483c5
BLAKE2b-256 f716878c0e96c6165430b826920119c2a92be0e0db15db09984cbc71a3d0ed12

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page