-
Notifications
You must be signed in to change notification settings - Fork 320
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 plotting of pre-shaped 2d data #3024
Improved plotting of pre-shaped 2d data #3024
Conversation
fa58925
to
fa524a0
Compare
Codecov Report
@@ Coverage Diff @@
## master #3024 +/- ##
==========================================
+ Coverage 65.49% 65.51% +0.01%
==========================================
Files 213 213
Lines 28456 28491 +35
==========================================
+ Hits 18638 18666 +28
- Misses 9818 9825 +7 |
@jenshnielsen Just had a quick look and everything seems to work with the current version. Updated our plotting system and will continue to test this branch in normal operation over the next couple of days. Many thanks for resolving this issue. |
ff5964e
to
ddcc052
Compare
And better handling of data that is on a non rectilinar grid but without nan
@ThorvaldLarsen I ended up doing some more cleanup here. It would be great if you have a chance to test it again |
@QCoDeS/core ready for review |
@jenshnielsen will get our system updated and try it out in production over the next couple of days. Thanks! |
Co-authored-by: Mikhail Astafev <astafan8@gmail.com>
@jenshnielsen @trevormorgan tested across our current database and everything has been working great so far. I would say this is ready for merging. Only minor thing I ran into was for a completely empty dataset (dataset created but cancelled before any data was added) plotting fails with a "keyword error" which could be done more gracefully. This is a very rare case and for an empty dataset we obviously dont care about the plot. I think this has also been the normal behavior from the beginning and I would say perfectly fine to just leave as is. |
@ThorvaldLarsen thanks for the testing and feedback! This looks good to merge now so we can have it in the upcoming release. I'll make a note of this issue so we can make improvements for a more graceful failure due to an empty dataset but let's handle that in another PR. |
After the predefined shape was added to the dataset non measured data is filled with nans. This updates the 2d pcolormesh plot to handle this.
It does this by bypassing the logic that checks for shape since this is no longer needed. However Matplotlib cannot handle a pcolormesh plot where the x and y coordinates are nans so some logic is needed to ensure this is clipped correctly. There are two use cases to consider. If the data is on a rectilinear grid we can plot all rows and columns that contain non nan setpoints. For the other case of non rectilinear grid we currently fall back to flattening the data again and removing all nans. This may not be the optimal solution but is identical to what we had before introducing shapes.
This furthermore avoids using significant resources to find the right plot type when the plot type is already given.
For shaped data we pass the gridded x and y data directly to matplotlib and avoid having to do any reshaping.
We upgrade the Matplotlib requirements to 3.3 to avoid having to interpolate the edges of the individual patches but rely on Matplotlib to do that.
@ThorvaldLarsen can you check if this resolves #2995