Skip to content

Commit

Permalink
adding line tutorial [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Oct 18, 2017
1 parent a6d758f commit 73fffb2
Show file tree
Hide file tree
Showing 10 changed files with 1,222 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext

default: dirhtml
TUTORIALS = tutorials/quickstart.rst tutorials/autocorr.rst tutorials/monitor.rst
TUTORIALS = tutorials/quickstart.rst tutorials/autocorr.rst tutorials/monitor.rst \
tutorials/line.rst

tutorials/%.rst: _static/notebooks/%.ipynb tutorials/tutorial_rst.tpl
jupyter nbconvert --template tutorials/tutorial_rst --to rst $< --output-dir tutorials
Expand Down
749 changes: 749 additions & 0 deletions docs/_static/notebooks/line.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ emcee has been used in `quite a few projects in the astrophysical literature
Basic Usage
-----------

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

.. code-block:: python
import numpy as np
import emcee
def lnprob(x, ivar):
def log_prob(x, ivar):
return -0.5 * np.sum(ivar * x ** 2)
ndim, nwalkers = 10, 100
ndim, nwalkers = 5, 100
ivar = 1. / np.random.rand(ndim)
p0 = [np.random.rand(ndim) for i in range(nwalkers)]
p0 = np.random.randn(nwalkers, ndim)
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=[ivar])
sampler.run_mcmc(p0, 1000)
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.

Expand Down

0 comments on commit 73fffb2

Please sign in to comment.