8000 Speed up mesh-based autoalign plotting of Maps by ayshih · Pull Request #8161 · sunpy/sunpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Speed up mesh-based autoalign plotting of Maps #8161

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

Merged
merged 4 commits into from
May 12, 2025

Conversation

ayshih
Copy link
Member
@ayshih ayshih commented May 3, 2025

For autoalign plotting of Maps (using pcolormesh() internally), it's nice that we can pass matplotlib the pixel->pixel transformation via the transform keyword, but that means that matplotlib performs the transformation with every rendering update (e.g., panning). Instead, we can refactor the approach so that the pixel->pixel transformation is performed only once, and then panning performance greatly improves. pcolormesh() still needs time to render all the data pixels, but autoalign=True is far less miserable now for interactive plots.

As a bonus, because we compute the transformation ourselves instead of having matplotlib do it, we can now properly update the plot limits. Previously, matplotlib's automatic detection would get thrown off by any NaNs in the coordinates.

@ayshih ayshih added the map Affects the map submodule label May 3, 2025
@ayshih

This comment was marked as outdated.

@Cadair

This comment was marked as outdated.

@ayshih

This comment was marked as outdated.

@ayshih ayshih force-pushed the autoalign_faster branch from 91e69f8 to e2d8b1a Compare May 5, 2025 18:18
@ayshih
Copy link
Member Author
ayshih commented May 5, 2025

After lots of testing, I have decided that matplotlib is making the correct decision to not allow NaN input to pcolormesh() (at least by default). I've adjusted this PR so that the precomputation is stored as a lookup table in a matplotlib transform, and so pcolormesh() can be happy and rendering does not require recomputation.

@ayshih ayshih added the No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers) label May 5, 2025
@ayshih ayshih force-pushed the autoalign_faster branch 4 times, most recently from 3d86203 to 1c0824a Compare May 6, 2025 03:22
@ayshih ayshih marked this pull request as ready for review May 6, 2025 03:28
@ayshih ayshih requested a review from a team as a code owner May 6, 2025 03:28
@ayshih ayshih changed the title Speed up autoalign plotting of Maps Speed up mesh-based autoalign plotting of Maps May 6, 2025
@ayshih ayshih force-pushed the autoalign_faster branch 2 times, most recently from d3c12b1 to d9ca0ea Compare May 6, 2025 12:49
Copy link
Member
@Cadair Cadair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks great. Just a small 🦬 to 🪒 as always.

@ayshih ayshih force-pushed the autoalign_faster branch from d9ca0ea to b39b523 Compare May 6, 2025 13:41
@ayshih ayshih requested a review from a team as a code owner May 6, 2025 16:35
@nabobalis nabobalis merged commit 4d00108 into sunpy:main May 12, 2025
9 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
map Affects the map submodule No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0