{ "info": { "author": "Uwe Schmitt", "author_email": "uwe.schmitt@id.ethz.ch", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "About uhammer\n==============\n\n``uhammer`` offers a convenience layer for ``emcee``.\n\nFeatures: ``uhammer``\n\n- offers a simplified API.\n- requires no code changes between running on multiple cores or with MPI.\n- fixes some issues with the MPI Pool from emcee / schwimmbad.\n- prints diagnostic messages when allocated nodes / cores do not fit well to specified\n number of walkers or other parallelization related settings.\n- can capture worker specific output to separate files.\n- implements persisting of sampler state and supports continuation of sampling at a later time.\n- can show an animated progress bar.\n\n\nExample usage\n-------------\n\nTo use ``uhammer`` you need:\n\n- an instance of ``Parameters`` for declaring the\n parameters you want to sample from.\n\n- a function, e.g. named ``lnprob``, which takes a parameters object and possible\n extra arguments. This function returns the logarithic value of the computed\n posterior probability.\n\n- finally you call ``sample`` for running the sampler.\n\n.. code-block:: python\n\n import time\n\n import numpy as np\n\n from uhammer import Parameters, sample\n\n sigma = .5\n\n\n def gen_data():\n a0 = .5\n b0 = .5\n c0 = 1\n\n x = np.linspace(-2, 2, 100)\n y_measured = a0 + b0 * x + c0 * x ** 2 + sigma * np.random.randn(*x.shape)\n return x, y_measured\n\n\n p = Parameters()\n p.add(\"a\", (0, 1))\n p.add(\"b\", (0, 1))\n p.add(\"c\", (0, 2))\n\n\n def lnprob(p, x, y_measured):\n time.sleep(.0002)\n y = p.a + p.b * x + p.c * x ** 2\n diff = (y - y_measured) / sigma\n return -np.dot(diff.T, diff) / 2\n\n\n n_samples = 15000\n n_walkers_per_param = 200\n\n\n samples, lnprobs = sample(\n lnprob,\n p,\n args=gen_data(),\n n_walkers_per_param=n_walkers_per_param,\n n_samples=n_samples,\n show_progress=True,\n show_output=False,\n )\n\n print()\n print(samples[5000:].mean(axis=0))\n\n.. code-block:: shell-session\n\n $ python examples/sample_line_fit.py\n uhammer: perform 25 steps of emcee sampler\n \u2717 passed: 00:00:11.2 left: 00:00:00.0 - [\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223\u2223]\n\n [0.52389808 0.53415134 1.01585175]\n\n\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `uweschmitt/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`uweschmitt/cookiecutter-pypackage`: https://github.com/uweschmitt/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.4.0 (2019-07-03)\n-------------------\n- Ignore start values for parameters. Did not play well with the emcee algorithm.\n\n\n0.3.2 (2019-05-24)\n-------------------\n- Less chatty and simpler progress report on euler. The existing progressbar\n cluttered the lsf output files. Now we report in min time intervals of \n at least 30 seconds.\n\n\n0.3.1 (2019-05-22)\n-------------------\n- removed `mpipool` from installation dependencies, else installation always needs\n a working MPI setup. Still `mpirpool` is needed when run in parallel MPI mode.\n\n0.3.0 (2019-05-22)\n-------------------\n- sample functions now return two arrays: the samples and the related log probabilities\n- `Parameters.add` now has an optional argument for providing a starting value.\n- `load_samples` function allows extracting samples from a persisted sampler file.\n- Replaced `capture_output` argument of `sample` and `continue_sampling` by two\n arguments `show_output` and `output_prefix`.\n- Fixed bug in output recording in `continue_sampling` function.\n- Use `mpipool` librariy now + added test for `mpi` based parallel sampling.\n\n0.2.13 (2019-05-15)\n-------------------\n- fix persisting pickler error in parallel mode\n\n0.2.12 (2019-05-02)\n-------------------\n- minor tweaks for mpi\n- fix for emcee 3 dev version\n\n0.2.11 (2019-04-30)\n-------------------\n- shutdown mpi pool in case a worker throws an exception, before\n this fix mpirun would hang.\n- fix handling of capture output file names when running with mpi\n\n0.2.10 (2019-04-19)\n-------------------\n- fix race condition when removing marker file\n- deactivate unnecessary warnings about missing mpi4py\n\n\n0.2.9 (2019-04-16)\n------------------\n* Don't show progressbar when run on euler node\n* Works with Python 3.7\n\n0.2.8 (2019-04-12)\n------------------\n* Fix to work with dev version of emcee 3\n\n0.2.7 (2019-03-20)\n------------------\n* Fix issue with capuring output in parallel mode\n* Stop progress bar in case of unhandled exception\n\n\n0.2.6 (2019-03-20)\n------------------\n* Fix dependencies for Python 3.7 in setup.py\n\n\n0.2.5 (2019-03-20)\n------------------\n\n* Fix package lookup in requirements_dev.txt\n* Fix error in error handling when output redirection fails.\n\n0.2.4 (2018-10-29)\n------------------\n\n* fix ordering of sampler output rows.\n\n0.2.3 (2018-10-24)\n------------------\n\n* check OMP_NUM_THREADS to warn of possible over subscription.\n* better pickling support for posterior function.\n\n0.2.2 (2018-10-11)\n------------------\n\n* Fix detection if uhammer runs on full node on euler.\n* Dont show statusbar if direct write to fid 1 is not possible.\n* Supress some unappropriate error messages from MPI, even if\n uhammer is not run using mpirun.\n* Fix ip check to detect if uhammer runs on euler.\n\n0.2.1 (2018-09-28)\n------------------\n\n* Fix of regression due to implementation of Python 2 support.\n\n0.2.0 (2018-09-28)\n------------------\n\n* Introduced Python 2 support.\n\n0.1.0 (2018-08-23)\n------------------\n\n* Initial version.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "uhammer", "package_url": "https://pypi.org/project/uhammer/", "platform": "", "project_url": "https://pypi.org/project/uhammer/", "project_urls": null, "release_url": "https://pypi.org/project/uhammer/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "Convenience layer for emcee sampler", "version": "0.4.0" }, "last_serial": 5481146, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "71b0c2d273a240b7e786a7e284b6ac14", "sha256": "03fa0c8938e1e4a153505844356bac60599a7e419efa993b458c6653549bfce5" }, "downloads": -1, "filename": "uhammer-0.3.0.tar.gz", "has_sig": false, "md5_digest": "71b0c2d273a240b7e786a7e284b6ac14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34017, "upload_time": "2019-05-22T13:15:24", "url": "https://files.pythonhosted.org/packages/bf/4a/cfcb26ebfb9fdd1136d64ea86666272c2549af35efba474dbe921bab50e6/uhammer-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "4980ad3a2fd4b00edaf0abc861efca6a", "sha256": "6be0346f287e57b7f62979c978f62a9c157477ae9910a4eb5fab80c4f6224d00" }, "downloads": -1, "filename": "uhammer-0.3.1.tar.gz", "has_sig": false, "md5_digest": "4980ad3a2fd4b00edaf0abc861efca6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34162, "upload_time": "2019-05-22T13:16:42", "url": "https://files.pythonhosted.org/packages/1d/72/e9dec56fd00615a6b6fbe1100f52ec522d292712600fdaff1f6b32875e7f/uhammer-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "45390d047a88f5f6c5d2cce80141f111", "sha256": "1c526ad475281273b5c1206e31f9d03df85b59f1d88f91898535084a657da213" }, "downloads": -1, "filename": "uhammer-0.3.2.tar.gz", "has_sig": false, "md5_digest": "45390d047a88f5f6c5d2cce80141f111", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35894, "upload_time": "2019-05-24T15:34:48", "url": "https://files.pythonhosted.org/packages/66/ac/6f0534a8448d6d24675a3a1bd4565a8dda3c7777ce378860ad8c6a1aad92/uhammer-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "8557ae14deaf756417da124483667975", "sha256": "2ed94b0e904aa2012b871fafea6bd95f0b291791bb27e42447b53a979061cdf9" }, "downloads": -1, "filename": "uhammer-0.3.3.tar.gz", "has_sig": false, "md5_digest": "8557ae14deaf756417da124483667975", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35332, "upload_time": "2019-06-11T16:29:41", "url": "https://files.pythonhosted.org/packages/4e/5e/07d7de36e1b8b83acc1b8e86def3b6f6afafdcfc2db320239200b819f43b/uhammer-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "0b0ab9bc006d9b731f6335b751d0df90", "sha256": "e7116192202cb600ef7e2831859ce18d7e9d04bcccbd896b70a4c90c5bf63175" }, "downloads": -1, "filename": "uhammer-0.3.4.tar.gz", "has_sig": false, "md5_digest": "0b0ab9bc006d9b731f6335b751d0df90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36576, "upload_time": "2019-06-11T16:44:34", "url": "https://files.pythonhosted.org/packages/4f/a5/d8265e1528f02fa96f5e5d30efb3555e876a11902a5bad9b9cd3f013611a/uhammer-0.3.4.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "28286f20ea278f73b34ca3b2b3e7df9d", "sha256": "3c714c87356edcb7a4a271f041043c5b1c5c3e9017e10c4c05f712672bb5381b" }, "downloads": -1, "filename": "uhammer-0.4.0.tar.gz", "has_sig": false, "md5_digest": "28286f20ea278f73b34ca3b2b3e7df9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36770, "upload_time": "2019-07-03T12:44:56", "url": "https://files.pythonhosted.org/packages/e3/06/0c4aa0e9b5ec1c15ed3d0019b881a594207fcebc9204dfb4378ee779466b/uhammer-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "28286f20ea278f73b34ca3b2b3e7df9d", "sha256": "3c714c87356edcb7a4a271f041043c5b1c5c3e9017e10c4c05f712672bb5381b" }, "downloads": -1, "filename": "uhammer-0.4.0.tar.gz", "has_sig": false, "md5_digest": "28286f20ea278f73b34ca3b2b3e7df9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36770, "upload_time": "2019-07-03T12:44:56", "url": "https://files.pythonhosted.org/packages/e3/06/0c4aa0e9b5ec1c15ed3d0019b881a594207fcebc9204dfb4378ee779466b/uhammer-0.4.0.tar.gz" } ] }