{ "info": { "author": "Valentin Boettcher", "author_email": "hiro@protagon.space", "bugtrack_url": null, "classifiers": [], "description": "# Secondary Value\n[![Coverage Status](https://coveralls.io/repos/github/vale981/SecondaryValue/badge.svg)](https://coveralls.io/github/vale981/SecondaryValue)\n[![Build Status](https://travis-ci.org/vale981/SecondaryValue.svg?branch=master)](https://travis-ci.org/vale981/SecondaryValue)\n\nThis is a utility to simplify the calculation of values and their\nuncertaintues from symbolic formulas by using `sympy` and `numpy`.\n\n## Installation\nJust a quick `pip install SecondaryValue` will do.\n\n## Examples\n(A Documentation will follow soon. For now: look at the docstrings!)\n\n### Basic Usage\n```python\nfrom SecondaryValue import SecondaryValue\n\n# create a secondary value\n# the argument can be either a string or a sympy expression\nx = SecondaryValue(\"a*b/sqrt(c)\")\n\n# Calculate a result value by substi3tuting the keyword arguments\n# where a keyword agument may consist of (value, error_1, error_2, ...)\n# and (...) stands for any iterable.\nresult = x(a=(1, 20), b=(2, 30), c=2)\n\n# The calculation returns a numpy array with the length of the longest\n# keyword argument above: [value, error_1, error_2]\n# For each error_n the uncertainties error_n of the keyword args above are\n# used if present. This may be useful to calculate statistical and systemic\n# errors in one go.\nprint(result)\n# >> (1.41421356, 35.35533906)\n\n# As a goodie, you can print out the gaussian error distribution in\n# symbolic form. (Works best in Jupyter Notebooks)\nx.pretty_gauss_propagation('a', 'b', 'c')\n```\n\n### Default Values\nTo reduce boilerplate one can set default substitutions for symbols (with errors).\nThis especially useful for constants.\n\n```python\nfrom SecondaryValue import SecondaryValue\n\n# create a secondary value with default arguments\nx = SecondaryValue(\"a + b\", defaults=dict(b=1/2))\n\n# this works because `b` is substituted from the defaults\nresult = x(a=1/2)\nprint(result)\n# >> 1.0\n\n# As a goodie, you can print out the gaussian error distribution in\n# symbolic form. (Works best in Jupyter Notebooks)\nx.pretty_gauss_propagation('a', 'b', 'c')\n```\n\n### Vectorized Input\n`SecondaryValue` supports vectorized input. As a rule-of-thump: Put\nthe iterable (list, np.array) where you would put scalars.\n\nYou can mix scalars and vectors as long as all errors and values are\neither scalar or have the same length.\n\n```python\nfrom SecondaryValue import SecondaryValue\nx = SecondaryValue('a**2+b')\n\nx(a=[[1,2,3]], b=1)\n# >> array([ 2., 5., 10.])\n\nx(a=([1,2,3], 1), b=1)\n# >> (array([ 2., 5., 10.]), array([2., 4., 6.]))\n\nx(a=([1,2,3], [1,2,3]), b=1)\n# >> (array([ 2., 5., 10.]), array([ 2., 8., 18.]))\n\nx(a=([1,2,3], [1,2,3]), b=([1,2,3], 1))\n# >> (array([ 2., 6., 12.]), array([ 2.23606798, 8.06225775, 18.02775638]))\n\n# THAT DOES NOT WORK:\nx(a=([1,2,3], [1,2,3]), b=([1,2], 1))\n```\n\nIf all the returned arrays in the tuple have the same shape, you can\neasily convert that tuple to a numpy array:\n`np.array(x(a=([1,2,3], [1,2,3]), b=([1,2,3], 1)))`\n\n### Dependencies\nTo make the calculation of complex values easier, one can define\ndependencies for a `SecondaryValue`:\n\n```python\nfrom SecondaryValue import SecondaryValue\n\ndep = SecondaryValue('u')\nx = SecondaryValue(\"a + b\", dependencies=dict(a=dep))\n\n# x will now accept u as an additional kwarg and calculate d==dep on the fly\n# and return a dictionary containing it as a second return value if you\n# specify `retdeps=True`.\nprint(x(b=1, u=(1, 2), retdeps=True))\n# >> ((2.0, 2.0), {'a': ((1.0, 2.0), {})})\n\n# To make the output predictable, the dependencies aren't returned by deafult.\nprint(x(b=1, u=(1, 2)))\n# >> (2.0, 2.0)\n\n# you can overwrite the dependency calculation\nprint(x(b=1/2, a=1/2))\n# >> 1.0\n```\n\nIf there are no dependency values, an empty dict will be returned when\n`retdeps=True` is specified.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vale981/SecondaryValue", "keywords": "gaussian error propagation", "license": "GPLv3.0", "maintainer": "", "maintainer_email": "", "name": "SecondaryValue", "package_url": "https://pypi.org/project/SecondaryValue/", "platform": "", "project_url": "https://pypi.org/project/SecondaryValue/", "project_urls": { "Homepage": "https://github.com/vale981/SecondaryValue" }, "release_url": "https://pypi.org/project/SecondaryValue/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "A helper to calculate the gaussian error propagation.", "version": "0.2.0" }, "last_serial": 6004279, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "7c611b999013832b1a5fe9faf4442e99", "sha256": "988abcdd2edb92fab2e18aeabb6610a71bd7ac51f0fdeb1f3b68f67f1f3f64ea" }, "downloads": -1, "filename": "SecondaryValue-0.0.2.tar.gz", "has_sig": false, "md5_digest": "7c611b999013832b1a5fe9faf4442e99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2305, "upload_time": "2019-05-13T06:44:39", "url": "https://files.pythonhosted.org/packages/45/ef/632c35e58c74945432e2c52d5a3d7b094a4568904e8f06f1a78f8cbcd709/SecondaryValue-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "c0217d1cc8353b31a18e1a9d669f3b97", "sha256": "0be2615dd537d1f451455f94f17d56b9df5e7f99fea8402e6006db889fd0f721" }, "downloads": -1, "filename": "SecondaryValue-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c0217d1cc8353b31a18e1a9d669f3b97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2307, "upload_time": "2019-05-13T06:57:59", "url": "https://files.pythonhosted.org/packages/67/db/ec7ef7aae752724b03647889a2b1ef10bd3fd8f6773b9319e3c2dd9bb707/SecondaryValue-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "b2adcf285189669d1e48482b7ca535be", "sha256": "ef3c68c8b46ce48078b61f444ebdebe441718ad78dc9b609bd94a48382c718e8" }, "downloads": -1, "filename": "SecondaryValue-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b2adcf285189669d1e48482b7ca535be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3357, "upload_time": "2019-05-13T07:23:37", "url": "https://files.pythonhosted.org/packages/88/cc/7939bff31cf00f2b463a69e2a2313fa554db627fdc72322add4b42228a69/SecondaryValue-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "78abae72486831f5cddd43ce67a7db36", "sha256": "f9fe80f83f2c9701bfde7081b60cf12629d93a79ef84d3947bc78ae68f4a2c89" }, "downloads": -1, "filename": "SecondaryValue-0.0.5.tar.gz", "has_sig": false, "md5_digest": "78abae72486831f5cddd43ce67a7db36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3469, "upload_time": "2019-05-13T07:35:02", "url": "https://files.pythonhosted.org/packages/eb/67/8cde7886bd485ce47ccd009ad8d92c172ffe9cf6b9be2c4a079a5855d3a3/SecondaryValue-0.0.5.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "a8c1ec454186772a730053cb305829c4", "sha256": "cfca8947ab7863a403555b354ca7494131f046a6e452577a2ae6b7f2ba14a61c" }, "downloads": -1, "filename": "SecondaryValue-0.0.7.tar.gz", "has_sig": false, "md5_digest": "a8c1ec454186772a730053cb305829c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3692, "upload_time": "2019-05-13T07:57:34", "url": "https://files.pythonhosted.org/packages/be/fe/b27c9f856f203552ca6d7f9aade7ed1fdeb6994f8c3a44909d89772f9794/SecondaryValue-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "ddf5b073899f4630b21953348fc4ab89", "sha256": "f72e04da391aa257d8fdf0d825828e414e2e183b0aabc7ca049e5a119e41124e" }, "downloads": -1, "filename": "SecondaryValue-0.0.8.tar.gz", "has_sig": false, "md5_digest": "ddf5b073899f4630b21953348fc4ab89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3703, "upload_time": "2019-05-13T08:06:08", "url": "https://files.pythonhosted.org/packages/86/ad/87691d047d4737d1a8c25480171ba4f42115f805023adfc84bc4d3696bdd/SecondaryValue-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "40701a61356647eb28918ae3dc728ecf", "sha256": "0ba3dcac08f7f35194f21d33cad43af85eebf494c4e0f5a3ad21295e3cf08c42" }, "downloads": -1, "filename": "SecondaryValue-0.0.9.tar.gz", "has_sig": false, "md5_digest": "40701a61356647eb28918ae3dc728ecf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3718, "upload_time": "2019-05-13T08:25:05", "url": "https://files.pythonhosted.org/packages/7f/d7/c9fa2ebf51f311289c7061fd44c2ed348397e5b65e446a3f486ea42d4620/SecondaryValue-0.0.9.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "0d531a21ab7b1ca6ede115afc3d535dd", "sha256": "a45bf679672905e59f60f02806dfe5e69763e88e2dc9abf95b98ba5dd5602b08" }, "downloads": -1, "filename": "SecondaryValue-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0d531a21ab7b1ca6ede115afc3d535dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3794, "upload_time": "2019-05-13T10:07:37", "url": "https://files.pythonhosted.org/packages/b8/66/e1f89d505d5a763ac13295fe381539163af0b3355224a3fc966b0fa60358/SecondaryValue-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "25aa0520a897fddcd688ab93231ed4fb", "sha256": "73ea1c7abbed7e35b47963c2c5aa62a49fc9c6e50fc3cd589e157003cf6f7307" }, "downloads": -1, "filename": "SecondaryValue-0.1.1.tar.gz", "has_sig": false, "md5_digest": "25aa0520a897fddcd688ab93231ed4fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4891, "upload_time": "2019-05-13T14:05:33", "url": "https://files.pythonhosted.org/packages/a8/95/f69c79c1ce397752bcde45d23eb7750e484b719c3f4bb77ed59a4ffa79cb/SecondaryValue-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "990cd4adb9c143c9eb610b3d9f778d6a", "sha256": "dd8142ae649d1c5d16facf3d04850417394b4ade08022265f3ec2c02ac6e10f3" }, "downloads": -1, "filename": "SecondaryValue-0.1.2.tar.gz", "has_sig": false, "md5_digest": "990cd4adb9c143c9eb610b3d9f778d6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4883, "upload_time": "2019-05-14T14:03:42", "url": "https://files.pythonhosted.org/packages/06/8e/b8af22df94472b12de9575851cfce1bbc75732db71144f6ede08e8fd47c6/SecondaryValue-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "74f6a177fed45009ae8d8e19b43944ff", "sha256": "7c2d488f98af5e83873a785871e7e9dea1471bd06ae6d808dbcb93871d0e983e" }, "downloads": -1, "filename": "SecondaryValue-0.1.3.tar.gz", "has_sig": false, "md5_digest": "74f6a177fed45009ae8d8e19b43944ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4919, "upload_time": "2019-05-14T19:44:48", "url": "https://files.pythonhosted.org/packages/51/5b/def9a3ca213b31945334de105a01297db646af7dd34cbd628a8b6ce008e8/SecondaryValue-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "867fe91b88b09009f42ca7a43929ab0e", "sha256": "6f42ece169ec86bcd50439a7dc938b1e163a54ecbf032ef4c9082d50cf14fa47" }, "downloads": -1, "filename": "SecondaryValue-0.1.4.tar.gz", "has_sig": false, "md5_digest": "867fe91b88b09009f42ca7a43929ab0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5289, "upload_time": "2019-05-15T05:08:37", "url": "https://files.pythonhosted.org/packages/a8/24/aee3394e8408714e5ee754db8032a844c9e6c1af7d702f89443b385894ae/SecondaryValue-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "cedf4aefe6e7e2df6b9370c556456a9e", "sha256": "fc8650cf193e83750d3a2bd392a391cf75a00f53250ac31deb0df25ac6e82bd6" }, "downloads": -1, "filename": "SecondaryValue-0.1.5.tar.gz", "has_sig": false, "md5_digest": "cedf4aefe6e7e2df6b9370c556456a9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5055, "upload_time": "2019-05-15T06:56:05", "url": "https://files.pythonhosted.org/packages/86/d7/93b0e1481c237f556a2f6ece4aedeb9d14d7c0555b84a86ec3293e07a2b5/SecondaryValue-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "27ead12cb8433aa1a8c048a84bc40e89", "sha256": "dbefc1e6fea0c1db071964a7273d0a04b8fd6c64fe7e1d0aa10147102e9ed2f2" }, "downloads": -1, "filename": "SecondaryValue-0.1.6.tar.gz", "has_sig": false, "md5_digest": "27ead12cb8433aa1a8c048a84bc40e89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5062, "upload_time": "2019-05-15T09:50:44", "url": "https://files.pythonhosted.org/packages/7d/3c/af868a7dfff318dbe4f07802ce451c94ce8f7efff674a5846fb2230cc964/SecondaryValue-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "583eaca4467c1d0dda880ead6a50010a", "sha256": "b678a625fe7e90f3f43b6442704baa2ccb3fa5d968001aaa98284c4bf811f76d" }, "downloads": -1, "filename": "SecondaryValue-0.1.7.tar.gz", "has_sig": false, "md5_digest": "583eaca4467c1d0dda880ead6a50010a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5083, "upload_time": "2019-05-15T10:18:33", "url": "https://files.pythonhosted.org/packages/c4/a6/e3966a8ef58c2133316efc312dccd86166e3147c50f36b6440b8bf42ba0e/SecondaryValue-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "4636abfa0ebce05253cb0cd4227fff96", "sha256": "fbc5c2c0da0a17459834b31d1a543f1ac71ea3e3f96469c4f37eea6bb2fc84c4" }, "downloads": -1, "filename": "SecondaryValue-0.1.8.tar.gz", "has_sig": false, "md5_digest": "4636abfa0ebce05253cb0cd4227fff96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6341, "upload_time": "2019-05-18T08:06:18", "url": "https://files.pythonhosted.org/packages/79/4d/c18b3acfe830720114e7cff35c4d7796d13e7798a18edeb5e2258644bdd4/SecondaryValue-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "d6d598bb544753191927cc995f3a171e", "sha256": "6dd56af1a6a46f58688c8a81a4a697a8c3c6687c1c73db66e1958036359b5ac0" }, "downloads": -1, "filename": "SecondaryValue-0.1.9.tar.gz", "has_sig": false, "md5_digest": "d6d598bb544753191927cc995f3a171e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6346, "upload_time": "2019-05-20T14:45:11", "url": "https://files.pythonhosted.org/packages/60/66/386e683a7a69968563a9d0f1cf2bc4a687a912ceed4c0062696f0c4ee037/SecondaryValue-0.1.9.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "da17db91b9c40cd516333bcf1c90c40a", "sha256": "5bc2567a0fb05b728945ad4143a5a663da0be19efe04fe8666518ea85812073b" }, "downloads": -1, "filename": "SecondaryValue-0.2.0.tar.gz", "has_sig": false, "md5_digest": "da17db91b9c40cd516333bcf1c90c40a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6545, "upload_time": "2019-10-20T18:40:47", "url": "https://files.pythonhosted.org/packages/4c/e5/92588d9d837a8f5808a0b48ee977b99ea17ea30f3173f7650f2a64291c2c/SecondaryValue-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "da17db91b9c40cd516333bcf1c90c40a", "sha256": "5bc2567a0fb05b728945ad4143a5a663da0be19efe04fe8666518ea85812073b" }, "downloads": -1, "filename": "SecondaryValue-0.2.0.tar.gz", "has_sig": false, "md5_digest": "da17db91b9c40cd516333bcf1c90c40a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6545, "upload_time": "2019-10-20T18:40:47", "url": "https://files.pythonhosted.org/packages/4c/e5/92588d9d837a8f5808a0b48ee977b99ea17ea30f3173f7650f2a64291c2c/SecondaryValue-0.2.0.tar.gz" } ] }