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
Improved checking logic of _check_xyz in contour.py #1471
Improved checking logic of _check_xyz in contour.py #1471
Conversation
@@ -0,0 +1,127 @@ | |||
import numpy as np | |||
from matplotlib import pyplot as plt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: All tests which use pyplot should either be an image test, or use the cleanup decroator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks! Added.
@pelson - the tests appear to be passing now. |
+1 |
elif x.ndim == 2: | ||
|
||
if x.shape != z.shape: | ||
raise TypeError("Shape of x does not match that of z: found {0} instead of {1}.".format(x.shape, z.shape)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the TypeError
below stretch to longer than 78 characters. In lieu of porting the codebase to be PEP8 compliant, could you wrap these and any other lines that are too long?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed now.
@astrofrog - sadly doesn't automatically merge. would you mind rebasing please? |
@pelson - done! All tests seem to pass on Travis. |
Improved checking logic of _check_xyz in contour.py
At the moment, if one calls
contour
with:and
x
andy
are 2-d arrays with a different shape fromz
, the error iswhich caused me much confusion. I dug into the code, and I realized the logic and errors could be significantly improved, so I've done that here, and added some tests. It should now give more informative/relevant errors.