-
Notifications
You must be signed in to change notification settings - Fork 5
Optimized fast image for linspace coords #393
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
Conversation
… ratio which happens with imshow
| @@ -0,0 +1,249 @@ | |||
| # SPDX-License-Identifier: BSD-3-Clause | |||
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.
This file was moved basically without changes
| **kwargs, | ||
| if all( | ||
| (data.coords[dim].ndim < 2) | ||
| and ((data.coords[dim].dtype == str) or (sc.islinspace(data.coords[dim]))) |
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.
This requires that there are dim-coords for each dim. (Because it uses data.coords[dim].) Was this a requirement already before?
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. If the input is missing them, some dummy (arange) coords are added before you get to here.
There are tests for this. See e.g.
plopp/tests/plotting/plot_1d_test.py
Line 51 in 69a60a3
| def test_plot_data_array_missing_coords(): |
| rasterized: bool = True, | ||
| **kwargs, | ||
| if all( | ||
| (data.coords[dim].ndim < 2) |
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.
Can FastImage handle scalar coords?
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 there is a scalar coord that does not have the same name as a dimension
da = pp.data.data2d()
da.coords['scalar'] = sc.scalar(333., unit='K')
da.plot()is fine (the 'scalar' coord is just ignored.
Interestingly, if the scalar coord is named 'x'
da = pp.data.data2d()
da.coords['x'] = sc.scalar(333., unit='K')
dait fails, but also fails on main.
I can fix in another PR...
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.
See #425
This adds two branches for plotting images: the old pcolormesh that can handle any coords, and a fast optimized branch that uses imshow to show images with linspace coords.
Fixes #392