-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Preparations for multivariate plotting #29877
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
base: main
Are you sure you want to change the base?
Changes from all commits
5e0266a
6985111
f42d65b
73713e7
78b173e
3979e09
adb4ee3
a276d89
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 |
---|---|---|
|
@@ -690,7 +690,17 @@ | |
try: | ||
xm = np.ma.masked_where(~(np.isfinite(x)), x, copy=False) | ||
except TypeError: | ||
return x | ||
if len(x.dtype.descr) == 1: | ||
return x | ||
else: | ||
# in case of a dtype with multiple fields: | ||
try: | ||
mask = np.empty(x.shape, dtype=np.dtype('bool, '*len(x.dtype.descr))) | ||
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. Could the dtype be e.g. 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. This is an interesting idea. I'll make a prototype and see if this would add unnecessary complexity somewhere else. |
||
for dd, dm in zip(x.dtype.descr, mask.dtype.descr): | ||
mask[dm[0]] = ~(np.isfinite(x[dd[0]])) | ||
xm = np.ma.array(x, mask=mask, copy=False) | ||
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. Do numpy masked arrays actually support struct arrays as mask, with possibly different masking of the fields? 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 have found that this is the only way numpy supports masking dtypes with multiple fields, but I will see if |
||
except TypeError: | ||
return x | ||
return xm | ||
|
||
|
||
|
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.
Would be good to get at least partial coverage for this branch.
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 haven't really been involved in this work nor understand how it works, but there is quite a bit of introduced code to deal with multiple datatypes? If this will be covered by tests/functionality in later PRs, that is fine, if not, please add tests for (most of) it.
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 was asked to split #29221 into multiple PRs, and this PR is one of them.
There is tests for this functionality in #29221 using the top-level plotting functions (axes.imshow() etc.)
In my mind it is better to test using the top-level API, but if you wish I could add dedicated testing to this PR.