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

Fix for #4984 #4985

Merged
merged 1 commit into from Aug 25, 2015
Merged

Fix for #4984 #4985

merged 1 commit into from Aug 25, 2015

Conversation

wackywendell
Copy link
Contributor

This is a very simple assertion to test for the issue described in #4984, and a test to go with it.

@WeatherGod
Copy link
Member

Don't use asserts to protect against bad user inputs. Asserts can be optimized away. If the input is bad, then raise a ValueError.

@wackywendell
Copy link
Contributor Author

Thank you, that's a good point. Does it look better now?

@@ -2825,6 +2825,12 @@ def xywhere(xs, ys, mask):
in cbook.safezip(x, xerr[1])]
else:
# using list comps rather than arrays to preserve units
if not (len(xerr) == 1 or # scalar
# or symmetric errorbars, which must be a single list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty minor, but I really don't like these long in-logic comments, I find it makes the code hard to read.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, the comment about the list comprehensions is now separated from the list comprehensions.

@wackywendell
Copy link
Contributor Author

Good points, thanks again! Any more?

@tacaswell
Copy link
Member

Can you add a test of a (N, 1) array going through?

@tacaswell
Copy link
Member

Thanks for putting up with us.

@wackywendell
Copy link
Contributor Author

Thanks for putting up with us.

Hey, thanks for the help and understanding!

(len(xerr) == len(x) and not (
iterable(xerr[0]) and len(xerr[0]) > 1))):
raise ValueError("yerr must be a scalar, the same "
"dimensions as y, or 2xN.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yerr --> xerr and y --> x

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! That one was pretty dumb. Thanks!

@WeatherGod
Copy link
Member

No worries. This is why code reviews are done and even the regular devs don't self-merge PRs.

This looks fine to me once Travis passes.

xerr = 0.1 + yerr

print(np.shape(y))
print(np.shape(yerr))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny issue but I would suggest removing these prints

They will show up in the test output with -s passed to nose without any context

@WeatherGod
Copy link
Member

Thank you!

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

Successfully merging this pull request may close these issues.

None yet

5 participants