-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[WIP] add matrix checking function for quiver input #7461
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
Changes from all commits
d8841a8
bba1ea6
4bdcac3
22655b6
73a69a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,12 +372,13 @@ def _parse_args(*args): | |
X, Y, U, V, C = [None] * 5 | ||
args = list(args) | ||
|
||
# The use of atleast_1d allows for handling scalar arguments while also | ||
# keeping masked arrays | ||
if len(args) == 3 or len(args) == 5: | ||
if len(args) == 2 or len(args) == 4: | ||
V = np.atleast_1d(args.pop(-1)) | ||
U = np.atleast_1d(args.pop(-1)) | ||
elif len(args) == 3 or len(args) == 5: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are increasing the number of lines of code here, and I don't see any benefit to it. If you left it the way it was, all you would have to do is insert your U = np.atleast_1d(cbook._check_array(args.pop(-1))) Better yet, you could modify your checking function to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that doing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @trpham, I disagree. We need to encapsulate logical chunks of argument validation that typically go together so as to minimize code duplication. The consolidation I am suggesting here is really minimal--it is ensuring that a given argument is some sort of ndarray but not a matrix. That's consistent with the name |
||
C = np.atleast_1d(args.pop(-1)) | ||
V = np.atleast_1d(args.pop(-1)) | ||
U = np.atleast_1d(args.pop(-1)) | ||
V = np.atleast_1d(args.pop(-1)) | ||
U = np.atleast_1d(args.pop(-1)) | ||
if U.ndim == 1: | ||
nr, nc = 1, U.shape[0] | ||
else: | ||
|
@@ -389,6 +390,9 @@ def _parse_args(*args): | |
else: | ||
indexgrid = np.meshgrid(np.arange(nc), np.arange(nr)) | ||
X, Y = [np.ravel(a) for a in indexgrid] | ||
cbook._check_array(U) | ||
cbook._check_array(V) | ||
cbook._check_array(C) | ||
return X, Y, U, V, C | ||
|
||
|
||
|
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.
If you really want to touch this function, I'd just alias
recursive_remove
toshutil.rmtree
(withonerror
set to remove files) :-) Otherwise this is kind of pointless.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.
I just changed the comment part according to the pep8 style. Nothing is changed within the function.
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.
Yes, I don't think that's really in the scope of this PR.