Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equal contour levels #77

Closed
tjgalvin opened this issue Feb 9, 2016 · 4 comments
Closed

Equal contour levels #77

tjgalvin opened this issue Feb 9, 2016 · 4 comments

Comments

@tjgalvin
Copy link

tjgalvin commented Feb 9, 2016

With the recent bug highlighted in #68 the contour levels have been sorted to ensure they are in an increasing order so the call to contourf() does not fail.

I recently came across another related issue. When you are trying to plot a set of samples which have an extremely skewed (for instance, when the sampling is converging on a hard coded upper/lower limit in some model), it is possible for the contour levels to be equal and will subsequently cause contourf() to fail as there is a difference of 0 between two or more elements of the V list.

A simple fix I have used is to test for equal elements and disable the contour plotting if any are present after the V list in corner.hist2d has been sorted.

if len(V) != len(set(V)):
    logging.warn("Equal contour levels found. Explicitly disabling.")
    plot_contours = False
    no_fill_contours = True

Of course the problem could be because of a bad model or constraint leading to the bad sampling, but that's another problem for another day!

@dfm
Copy link
Owner

dfm commented Feb 9, 2016

Are you sure this wasn't fixed in #73? If so, please provide a test that fails when you use the most recent version. Thanks!

@tjgalvin
Copy link
Author

tjgalvin commented Feb 9, 2016

I missed the issue. Thanks for pointing it out to me.

I did a pip install corner today and can confirm the version I have installed is 1.0.1.

In [4]: corner.__version__
Out[4]: u'1.0.1'

Downloading the latest 1.0.1 off pypi I don't see the commits by zblz in the package there. I'm happy to chalk it up to user error by me if I have missed something.

The commit in #73 may fix my problem. I have a hard coded upper limit in my modeling that has been included to try to help prevent degeneracy, so 'zooming in' may work. Ultimately problem with the modelling, but it may be a good idea to allow the contouring to be disabled if the error is encountered as an option along side the zoom alternative?

@dfm
Copy link
Owner

dfm commented May 26, 2016

There is a new version on PyPI with the commits from #73. Can you take a look and let me know if that is sufficient?

@tjgalvin
Copy link
Author

Only just got around to this. It looks all good for me now. Thanks for that!

@dfm dfm closed this as completed Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants