Skip to content

Latest commit

 

History

History
115 lines (85 loc) · 3.61 KB

index.rst

File metadata and controls

115 lines (85 loc) · 3.61 KB

emcee

emcee is an MIT licensed pure-Python implementation of Goodman & Weare's Affine Invariant Markov chain Monte Carlo (MCMC) Ensemble sampler and these pages will show you how to use it.

This documentation won't teach you too much about MCMC but there are a lot of resources available for that (try this one). We also published a paper explaining the emcee algorithm and implementation in detail.

emcee has been used in quite a few projects in the astrophysical literature and it is being actively developed on GitHub.

https://img.shields.io/badge/GitHub-dfm%2Femcee-blue.svg?style=flat https://img.shields.io/badge/license-MIT-blue.svg?style=flat https://img.shields.io/badge/arXiv-1202.3665-orange.svg?style=flat https://coveralls.io/repos/github/dfm/emcee/badge.svg?branch=main&style=flat

Basic Usage

If you wanted to draw samples from a 5 dimensional Gaussian, you would do something like:

import numpy as np
import emcee

def log_prob(x, ivar):
    return -0.5 * np.sum(ivar * x ** 2)

ndim, nwalkers = 5, 100
ivar = 1. / np.random.rand(ndim)
p0 = np.random.randn(nwalkers, ndim)

sampler = emcee.EnsembleSampler(nwalkers, ndim, log_prob, args=[ivar])
sampler.run_mcmc(p0, 10000)

A more complete example is available in the :ref:`quickstart` tutorial.

How to Use This Guide

To start, you're probably going to need to follow the :ref:`install` guide to get emcee installed on your computer. After you finish that, you can probably learn most of what you need from the tutorials listed below (you might want to start with :ref:`quickstart` and go from there). If you need more details about specific functionality, the User Guide below should have what you need.

We welcome bug reports, patches, feature requests, and other comments via the GitHub issue tracker, but you should check out the contribution guidelines first. If you have a question about the use of emcee, please post it to the users list instead of the issue tracker.

.. toctree::
   :maxdepth: 2
   :caption: User Guide

   user/install
   user/sampler
   user/moves
   user/blobs
   user/backends
   user/autocorr
   user/upgrade
   user/faq

.. toctree::
   :maxdepth: 1
   :caption: Tutorials

   tutorials/quickstart
   tutorials/line
   tutorials/parallel
   tutorials/autocorr
   tutorials/monitor
   tutorials/moves


License & Attribution

Copyright 2010-2021 Dan Foreman-Mackey and contributors.

emcee is free software made available under the MIT License. For details see the LICENSE.

If you make use of emcee in your work, please cite our paper (arXiv, ADS, BibTeX).

Changelog