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)
```

Discussion:
OriolAbril: I have read about `appveyor`, `conda` and their issues, and I think I understand why appveyor builds are failing. However, I am not totally sure yet, and in addition, I would like to comment the possible solutions with you to check which one do you prefer.

I have found some issues with error messages similars to the ones I got, but I think this issue is not related to any of them. Instead, I believe the problem is because tqdm 4.26 is the last version present in [https://repo.continuum.io/pkgs/main/win-32/](https://repo.continuum.io/pkgs/main/win-32/) for python 3.5. Newer versions are only present for python 2.7, 3.6 or 3.7. All previous pull requests used tqdm 4.26, thus, there was no problem. Now however, conda tries to install tqdm 4.31 in python 3.5 which results in the current error. 

In travis there is an environment with python 3.5 but in linux conda does not try to install tqdm. Then, even though tqdm versions larger than 4.26 are not present in [https://repo.continuum.io/pkgs/main/linux-64/](https://repo.continuum.io/pkgs/main/linux-64/), there is no error risen.

The possible solutions that come to my mind are:

1. Install tqdm via pip before the command `conda install -q conda-build numpy scipy h5py setuptools pytest`
2. Use python 3.6 instead of 3.5
3. Pin appveyor build to tqdm 4.26

I should have no problem implementing any of the three. Whenever you have time say which one you prefer or a 4th one I haven't though about and I will implement to see if it solves the problem.
OriolAbril: @dfm any comments on this? 
dfm: @OriolAbril: thanks for your patience! I'm just catching up on the backlog and I've got the builds passing again.

Would you mind opening a new pull request based on the current master that just fixes #289 and adds the lines to the test? Thanks a lot!

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)()