Repository: dfm/emcee

Issue:
sampler.lnprobability is transposed in emcee3?
tl;dr it looks like `sampler.lnprobability` is transposed in emcee 3 from what I would expect from emcee 2.

Sample code (copy pasta'd from the old docs):
```python
import numpy as np
import emcee

def lnprob(x, ivar):
    return -0.5 * np.sum(ivar * x ** 2)

ndim, nwalkers = 10, 100
ivar = 1. / np.random.rand(ndim)
p0 = [np.random.rand(ndim) for i in range(nwalkers)]

sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=[ivar])
_ = sampler.run_mcmc(p0, 1000)

print(emcee.__version__)
print(sampler.chain.shape, sampler.lnprobability.shape)
```

## Output from emcee 2.2.1
```
2.2.1
(100, 1000, 10) (100, 1000)
```

## Output from emcee 3.0rc2
```
3.0rc2
(100, 1000, 10) (1000, 100)
```

Comments:

Patch:
diff --git a/.travis.yml b/.travis.yml
index fa02161..4aa919c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,7 +23,7 @@ install:
   - travis_retry python setup.py develop
 
 script:
-  - py.test -v emcee/tests --cov emcee
+  - pytest -v emcee/tests --cov emcee
 
 after_success:
   - coveralls
diff --git a/emcee/ensemble.py b/emcee/ensemble.py
index ae6a976..7d30afc 100644
--- a/emcee/ensemble.py
+++ b/emcee/ensemble.py
@@ -478,8 +478,8 @@ class EnsembleSampler(object):
     @property
     @deprecated("get_log_prob()")
     def lnprobability(self):  # pragma: no cover
-        return self.get_log_prob()
-
+        log_prob = self.get_log_prob()
+        return np.swapaxes(log_prob, 0, 1)
     @property
     @deprecated("get_log_prob(flat=True)")
     def flatlnprobability(self):  # pragma: no cover


Test patch:
diff --git a/emcee/tests/unit/test_sampler.py b/emcee/tests/unit/test_sampler.py
index 48a351a..ca38a56 100644
--- a/emcee/tests/unit/test_sampler.py
+++ b/emcee/tests/unit/test_sampler.py
@@ -47,11 +47,15 @@ def test_shapes(backend, moves, nwalkers=32, ndim=3, nsteps=10, seed=1234):
         assert tau.shape == (ndim,)
 
         # Check the shapes.
-        assert sampler.chain.shape == (nwalkers, nsteps, ndim), \
-            "incorrect coordinate dimensions"
+        with pytest.warns(DeprecationWarning):
+            assert sampler.chain.shape == (nwalkers, nsteps, ndim), \
+                "incorrect coordinate dimensions"
+        with pytest.warns(DeprecationWarning):
+            assert sampler.lnprobability.shape == (nwalkers, nsteps), \
+                "incorrect probability dimensions"
         assert sampler.get_chain().shape == (nsteps, nwalkers, ndim), \
             "incorrect coordinate dimensions"
-        assert sampler.lnprobability.shape == (nsteps, nwalkers), \
+        assert sampler.get_log_prob().shape == (nsteps, nwalkers), \
             "incorrect probability dimensions"
 
         assert sampler.acceptance_fraction.shape == (nwalkers,), \
@@ -77,14 +81,14 @@ def test_errors(backend, nwalkers=32, ndim=3, nsteps=5, seed=1234):
 
         # Test for not running.
         with pytest.raises(AttributeError):
-            sampler.chain
+            sampler.get_chain()
         with pytest.raises(AttributeError):
-            sampler.lnprobability
+            sampler.get_log_prob()
 
         # What about not storing the chain.
         sampler.run_mcmc(coords, nsteps, store=False)
         with pytest.raises(AttributeError):
-            sampler.chain
+            sampler.get_chain()
 
         # Now what about if we try to continue using the sampler with an
         # ensemble of a different shape.
@@ -121,12 +125,15 @@ def run_sampler(backend, nwalkers=32, ndim=3, nsteps=25, seed=1234,
 def test_thin(backend):
     with backend() as be:
         with pytest.raises(ValueError):
-            run_sampler(be, thin=-1)
+            with pytest.warns(DeprecationWarning):
+                run_sampler(be, thin=-1)
         with pytest.raises(ValueError):
-            run_sampler(be, thin=0.1)
+            with pytest.warns(DeprecationWarning):
+                run_sampler(be, thin=0.1)
         thinby = 3
         sampler1 = run_sampler(None)
-        sampler2 = run_sampler(be, thin=thinby)
+        with pytest.warns(DeprecationWarning):
+            sampler2 = run_sampler(be, thin=thinby)
         for k in ["get_chain", "get_log_prob"]:
             a = getattr(sampler1, k)()[thinby-1::thinby]
             b = getattr(sampler2, k)()