{"id":32174950,"url":"https://github.com/mcfit/pyemcee","last_synced_at":"2026-02-21T03:31:30.901Z","repository":{"id":60722568,"uuid":"293653961","full_name":"mcfit/pyemcee","owner":"mcfit","description":"pyemcee - Python Implementation of the Affine-invariant MCMC Hammer","archived":false,"fork":false,"pushed_at":"2023-12-22T18:56:47.000Z","size":3035,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-10T05:21:52.771Z","etag":null,"topics":["emcee","ensemble-sample","hammer","mcmc","pyemcee","python"],"latest_commit_sha":null,"homepage":"https://mcfit.github.io/pyemcee","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcfit.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst"}},"created_at":"2020-09-07T23:37:54.000Z","updated_at":"2022-11-02T23:58:48.000Z","dependencies_parsed_at":"2023-12-22T19:32:28.247Z","dependency_job_id":"790bfc96-3073-4cb4-a205-3d8fe8da1b06","html_url":"https://github.com/mcfit/pyemcee","commit_stats":{"total_commits":50,"total_committers":1,"mean_commits":50.0,"dds":0.0,"last_synced_commit":"9d80d0dfdbee4ad1d4acf6f030961362655c9250"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mcfit/pyemcee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcfit%2Fpyemcee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcfit%2Fpyemcee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcfit%2Fpyemcee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcfit%2Fpyemcee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcfit","download_url":"https://codeload.github.com/mcfit/pyemcee/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcfit%2Fpyemcee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29672704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T03:11:15.450Z","status":"ssl_error","status_checked_at":"2026-02-21T03:10:34.920Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emcee","ensemble-sample","hammer","mcmc","pyemcee","python"],"created_at":"2025-10-21T19:17:14.799Z","updated_at":"2026-02-21T03:31:30.877Z","avatar_url":"https://github.com/mcfit.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"=======\npyemcee\n=======\n\n.. image:: https://img.shields.io/pypi/v/pyemcee.svg?style=flat\n    :target: https://pypi.python.org/pypi/pyemcee/\n    :alt: PyPI Version\n    \n.. image:: https://app.travis-ci.com/mcfit/pyemcee.svg?branch=master\n    :target: https://app.travis-ci.com/github/mcfit/pyemcee\n    :alt: Build Status\n    \n.. image:: https://ci.appveyor.com/api/projects/status/oqnksaooj338xn4d?svg=true\n    :target: https://ci.appveyor.com/project/danehkar/pyemcee\n    :alt: Build Status\n    \n.. image:: https://coveralls.io/repos/github/mcfit/pyemcee/badge.svg?\n    :target: https://coveralls.io/github/mcfit/pyemcee?branch=master\n    :alt: Coverage Status\n    \n.. image:: https://img.shields.io/badge/license-GPL-blue.svg\n    :target: https://github.com/mcfit/pyemcee/blob/master/LICENSE\n    :alt: GitHub license\n    \n.. image:: https://img.shields.io/conda/vn/conda-forge/pyemcee.svg\n    :target: https://anaconda.org/conda-forge/pyemcee\n    :alt: Anaconda Cloud\n    \n.. image:: https://readthedocs.org/projects/pyemcee/badge/?version=latest\n    :target: https://pyemcee.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n    \n.. image:: https://img.shields.io/badge/python-2.7%2C%203.5-blue.svg\n    :alt: Support Python versions 2.7, 3.4 and 3.5\n    \n.. image:: https://img.shields.io/badge/DOI-10.5281/zenodo.4495911-blue.svg\n    :target: https://doi.org/10.5281/zenodo.4495911\n    :alt: Zenodo\n    \n.. image:: https://mybinder.org/badge_logo.svg\n :target: https://mybinder.org/v2/gh/mcfit/pyemcee/HEAD?labpath=Notebook.ipynb\n\nDescription\n===========\n\n**pyemcee** is a Python implementation of the *affine-invariant Markov chain Monte Carlo (MCMC) ensemble sampler*, based on `sl_emcee \u003chttps://github.com/mcfit/sl_emcee\u003e`_ by `M. A. Nowak \u003chttp://space.mit.edu/home/mnowak/isis_vs_xspec/\u003e`_, an S-Lang/`ISIS \u003chttp://space.mit.edu/cxc/isis/\u003e`_ implementation of the MCMC Hammer proposed by `Goodman \u0026 Weare (2010) \u003chttp://dx.doi.org/10.2140/camcos.2010.5.65\u003e`_, and also implemented in Python (`emcee \u003chttps://github.com/dfm/emcee\u003e`_) by `Foreman-Mackey et al. (2013) \u003chttps://ui.adsabs.harvard.edu/abs/2013PASP..125..306F/abstract\u003e`_. \n\n\nInstallation\n============\n\nTo install the last version, all you should need to do is\n\n.. code-block::\n\n    $ python setup.py install\n\nTo install the stable version, you can use the preferred installer program (pip):\n\n.. code-block::\n\n    $ pip install pyemcee\n\nor you can install it from the cross-platform package manager *conda*:\n\n.. code-block::\n\n    $ conda install -c conda-forge pyemcee\n\nThis package requires the following packages:\n\n    - `NumPy \u003chttps://numpy.org/\u003e`_\n    - `SciPy \u003chttps://scipy.org/scipylib/\u003e`_\n    - `Matplotlib \u003chttps://matplotlib.org/\u003e`_\n\nHow to Use\n==========\n\nThe Documentation of the functions provides in detail in the *API Documentation* (`mcfit.github.io/pyemcee/doc \u003chttps://mcfit.github.io/pyemcee/doc\u003e`_). This Python library creates the MCMC sampling  for given upper and lower uncertainties, and propagates uncertainties of parameters into the function.\n\nSee *Jupyter Notebook*: `Notebook.ipynb \u003chttps://github.com/mcfit/pyemcee/blob/master/Notebook.ipynb\u003e`_\n\nRun *Jupyter Notebook* on `Binder \u003chttps://mybinder.org/v2/gh/mcfit/pyemcee/HEAD?labpath=Notebook.ipynb\u003e`_:\n\n.. image:: https://mybinder.org/badge_logo.svg\n :target: https://mybinder.org/v2/gh/mcfit/pyemcee/HEAD?labpath=Notebook.ipynb\n\nFirst, you need to load the **pyemcee** library as follows:\n\n.. code-block:: python\n\n    import pyemcee\n    import numpy as np\n\nYou need to define your function. For example:\n\n.. code-block:: python\n\n    def myfunc21(input1):\n       result1 = np.sum(input1)\n       result2 = input1[1] ** input1[0]\n       return [result1, result2]\n\nThen, specify the upper and lower uncertainties of the prior parameters:\n\n.. code-block:: python\n\n    input1 = np.array([1., 2.])\n    input1_err = np.array([0.2, 0.5])\n    input1_err_p = input1_err\n    input1_err_m = -input1_err\n    output1 = myfunc21(input1)\n    output1_num = len(output1)\n\nChoose the appropriate uncertainty distribution. For example, for a uniform distribution, use_gaussian=0, and a Gaussian distribution use_gaussian=1. Then, specify the number of walkers and the number of iterations, e.g. walk_num=30 and iteration_num=100. You can then create the MCMC sample and propagate the uncertainties of the input parameters into your defined functions as follows:\n\n.. code-block:: python\n\n    use_gaussian=0 # uniform distribution from min value to max value\n    walk_num=30 # number of walkers\n    iteration_num=100 # number of samplers\n    mcmc_sim = pyemcee.hammer(myfunc21, input1, input1_err_m, \n                              input1_err_p, output1, walk_num, \n                              iteration_num, use_gaussian)\n\nTo determine the upper and lower errors of the function outputs, you need to run with the chosen appropriate confidence level. For example, a 1.645-sigma standard deviation can be specified with clevel=0.90. For a 1-sigma standard deviation, we have clevel=0.682:\n\n.. code-block:: python\n\n    clevel=0.68268949 # 1-sigma\n    output1_error = pyemcee.find_errors(output1, mcmc_sim, clevel, do_plot=1)\n    \nwhich shows the following distribution histograms:\n\n.. image:: https://raw.githubusercontent.com/mcfit/pyemcee/master/examples/images/histogram0.png\n    :width: 100\n\n.. image:: https://raw.githubusercontent.com/mcfit/pyemcee/master/examples/images/histogram1.png\n    :width: 100\n\nTo prevent plotting, you should set do_plot=None. To print the results:\n\n.. code-block:: python\n\n    for i in range(0, output1_num):\n       print(output1[i], output1_error[i,:])\n\nwhich provide the upper and lower limits on each parameter:\n\n.. code-block::\n\n    3.0 [-0.35801017 0.35998471]\n    2.0 [-0.37573196 0.36297235]\n\nFor other standard deviation, you should use different confidence levels:\n\n.. code-block:: python\n\n    clevel=0.38292492 # 0.5-sigma\n    clevel=0.68268949 # 1.0-sigma\n    clevel=0.86638560 # 1.5-sigma\n    clevel=0.90       # 1.645-sigma\n    clevel=0.95       # 1.960-sigma\n    clevel=0.95449974 # 2.0-sigma\n    clevel=0.98758067 # 2.5-sigma\n    clevel=0.99       # 2.575-sigma\n    clevel=0.99730020 # 3.0-sigma\n    clevel=0.99953474 # 3.5-sigma\n    clevel=0.99993666 # 4.0-sigma\n    clevel=0.99999320 # 4.5-sigma\n    clevel=0.99999943 # 5.0-sigma\n    clevel=0.99999996 # 5.5-sigma\n    clevel=0.999999998# 6.0-sigma\n\nDocumentation\n=============\n\nFor more information on how to use the API functions from the pyemcee library, please read the `API Documentation  \u003chttps://mcfit.github.io/pyemcee/doc\u003e`_ published on `mcfit.github.io/pyemcee \u003chttps://mcfit.github.io/pyemcee\u003e`_.\n\n\nLearn More\n==========\n\n==================  =============================================\n**Documentation**   https://pyemcee.readthedocs.io/\n**Repository**      https://github.com/mcfit/pyemcee\n**Issues \u0026 Ideas**  https://github.com/mcfit/pyemcee/issues\n**Conda-Forge**     https://anaconda.org/conda-forge/pyemcee\n**PyPI**            https://pypi.org/project/pyemcee/\n**Archive**         `10.5281/zenodo.4495911 \u003chttps://doi.org/10.5281/zenodo.4495911\u003e`_\n==================  =============================================\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcfit%2Fpyemcee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcfit%2Fpyemcee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcfit%2Fpyemcee/lists"}