-
Notifications
You must be signed in to change notification settings - Fork 279
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
Add masking for phase plots. #2504
Conversation
I think with this change it should work fine. |
There have been enough wonky answer-store submodule changes that I've merged and pushed that merged version of this to get a new set of tests. |
I think that this is now going to be easier with the changes in unyt to support masked arrays. I will try again. |
Hi @matthewturk did you get a chance to look at unyt's updates to see if it is more compatible for these changes now? This seems like a cool feature! |
Just updated -- let's see how it does. |
@yt-fido test this please |
1 similar comment
@yt-fido test this please |
Aiming to figure this out in time for 4.0. |
closing + reopening to reactualize CI |
@neutrinoceros The two images you show have the same colorbounds, I think? |
They did, and still do, I'm just wondering wether negative values are expected to be displayed there. |
Anyway it looks to me that they used to be clipped to 0 (which is incorrect in any case), so I think the current behaviour is ok ! |
I think the root cause is related to what we are masking; previously, we were masking using the value zero. So, lots of the colors were very close to the color assigned to zero. (I suspect that using a symlog colorbar would draw this out more.) Now, we can actually see them. (And, coincidentally, the real values that were close to or equal to zero would show up, whereas before we couldn't pick them out.) |
There's been many changes in the answer store since this was last synced. I think we could simply merge this if we can get this green first, which you should be able to do by merging from the main branch again :) |
The one failure on Jenkins is expected, since the difference is intended. |
5810730
to
0d633bd
Compare
0d633bd
to
471c90b
Compare
Force-pushed with a rebase. |
I am not 100% convinced these differences are expected actually. |
One possibility is that now we are no longer using zeros anywhere, which may slightly change the colorbar calculation in vmin; if it gets a NaN it might do a different calculation than if not, in the norm. |
I'm not convinced either way. I cannot reproduce a similar change in pure matplotlib at the moment. AFAICT, masking with 0s or NaNs seems to produce visually identical results when using a LogNorm + "nearest" shading I'm however confident the patch is correct so I'm tempted to approve anyway, but this diff is intriguing. |
It seems plausible that #3793 may have resolved this problem. Let's run the test suite again: close+reopen |
This bugfix is crucial to a refactor I'm working on, so I'll be optimistic and use auto-merge and set it up for backport. 🤞🏻 |
@matthewturk I'd really like to move forward with this and I confirm that I think the new results are correct. Do you need a hand to update gold standards ? |
@neutrinoceros yes please |
Here's the supporting answer store PR yt-project/answer-store#30 and the patch needed to for Jenkins-hosted tested, in this PR diff --git a/tests/tests.yaml b/tests/tests.yaml
index e042e5670..f7836ea15 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -95,7 +95,7 @@ answer_tests:
- yt/frontends/owls/tests/test_outputs.py:test_snapshot_033
- yt/frontends/owls/tests/test_outputs.py:test_OWLS_particlefilter
- local_pw_041: # PR 3670
+ local_pw_042: # PR 2504
- yt/visualization/tests/test_plotwindow.py:test_attributes
- yt/visualization/tests/test_particle_plot.py:test_particle_projection_answers
- yt/visualization/tests/test_particle_plot.py:test_particle_projection_filter |
…4-on-yt-4.0.x Backport PR #2504 on branch yt-4.0.x (Add masking for phase plots.)
This PR does not yet work, because I need some help figuring out the right way to navigate a collision between unyt arrays and masked arrays.
Here is an example script:
And before and after images:
I made these with a slight modification to this PR, which was to change the creation of
masked_data
to:masked_data = np.ma.masked_array(data.v, ~self.profile.used)
(adding the
.v
on data)I'm not sure that's the right way to go. If I don't strip the unyt status, at some point in the copying process the
unyt
machinery tries to coerce the boolean mask into units, or something, which breaks stuff.