-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Contour kills Python #7486
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
Comments
I do not get it to kill python, but get the above exception (with numpy 1.11, might be different from OP). The issues here seems to be that when we try to find the levels we prune them to levels inside of the data range via # For line contours, drop levels outside the data range.
return lev[(lev > zmin) & (lev < zmax)] in which if the data is singular results in no levels and hence the issue. The specific work here is to:
This is a very limited change (so new-contributor friendly), but might require careful thought about what it should do in the singular case, hence medium difficulty. |
@godaygo Thanks for reporting this! |
@tacaswell, I don't see any point in making levels--contouring is fundamentally impossible without a single cell, which requires at least a 2x2. I think the thing to do raise a ValueError early on if any input array has a dimension less than 2. |
This may be numpy-specific. I think we ran into a similar error recently in On Sun, Nov 20, 2016 at 1:30 AM, Eric Firing notifications@github.com
|
You get the same exception with a uniform field
Erroring on non-sensible sized arrays in a different issue |
I'm using numpy 1.11.2+mkl from Gohlke, and I start script from Windows cmd (if it helps), @tacaswell yes I have the same traceback |
For sake of completeness: the segfault on Windows is at _contour.cpp#L1225. The modulo operation Call Stack:
Locals:
|
I'll submit a PR to deal with the |
Modulo by zero is the immediate cause of the crash reported by OP. |
@cgohlke Discussions between @tacaswell, @efiring and @WeatherGod are all about contouring with zero levels, showing stack traces in the python code before any of the C++ is called. Hence there are two separate issues. |
@ianthomas23 Is there a PR for the |
@tacaswell No, not yet. I hope to write one soon. |
BUG: handle empty levels array in contour, closes #7486
@tacaswell It turns out that the |
Matplotlib kills Python with:
plt.contour( [[1]], [[1]], [[1]])
Matplotlib 1.5.3
Python 3.5.2
Windows 10
The text was updated successfully, but these errors were encountered: