10000 Proof of concept use contourpy for contouring by dstansby · Pull Request #5923 · sunpy/sunpy · GitHub
[go: up one dir, main page]

Skip to content

Proof of concept use contourpy for contouring #5923

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

Closed
wants to merge 1 commit into from

Conversation

dstansby
Copy link
Member

See #5874. It didn't take me long to throw this together so thought I'd open a draft PR for discussion. Things we should consider (this is non-exhaustive and off the top of my head; please add to this):

  • Should we also change .draw_contour() to generate the contours through contourpy, to make them consistent with the results of contour()?

@Cadair
Copy link
Member
Cadair commented Mar 3, 2022

to make them consistent with the results of contour()?

isn't contourpy the same code mpl uses, so wont it be the same anyway?

@dstansby
Copy link
Member Author
dstansby commented Mar 3, 2022

to make them consistent with the results of contour()?

isn't contourpy the same code mpl uses, so wont it be the same anyway?

There are three different algorithms:

  • MPL to 2014
  • MPL 2014 - present
  • A new one which is the default and better because it has been written from scratch

I don't think there's any major differences between them, but if we use the default new algorithm for .contour() and the Axes.contour() default for drawing contours we might end up with slightly different contours.

@Cadair
Copy link
Member
Cadair commented Mar 3, 2022

Would we be able to ask mpl to use the new one via a kwarg when they depend on contourpy?

@dstansby
Copy link
Member Author
dstansby commented Mar 3, 2022

Yes, I think so

@dstansby
Copy link
Member Author
dstansby commented Mar 3, 2022

For reference, here's the Matplotlib issue and pull request:

matplotlib/matplotlib#22529
matplotlib/matplotlib#22567

@Cadair
Copy link
Member
Cadair commented Mar 3, 2022

Happy to change how we do it for now and drop back to the new mpl behaviour in ~18 months when we can depend on it in mpl?

setup.cfg Outdated
< 8000 /td> @@ -55,6 +55,7 @@ image =
jpeg2000 =
glymur>=0.8.18,!=0.9.0,!=0.9.5
map =
contourpy>=1

Choose a reason for hiding this comment

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

This should now be contourpy>=1.0.1. I had an unnecessary numpy version pin in contourpy which might cause problems, the new release fixes this.

@ianthomas23
Copy link

Contourpy dev here. Do you folks want mpl's contour/contourf to have a new kwarg for the contourpy algorithm name? I have been assuming that mpl will switch to using the new algorithm asap and that a kwarg isn't needed as it means explaining the algorithm options to end users who mostly just want it to work. But if there is a use case for the kwarg being there, I am happy to change my mind.

@Cadair
Copy link
Member
Cadair commented Mar 4, 2022

👋

If mpl switches to the new algorithm then I think it has the same effect for us, when we depend on that version of mpl we can say they do the same thing, so I think that approach is fine with us :)

@nabobalis nabobalis added this to the 4.0.0 milestone Mar 23, 2022
@nabobalis nabobalis added 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) labels Mar 31, 2022
@nabobalis
Copy link
Member

If we plan to work around the main issue that we have with scikit-image, do we just wait for MPL to depend on contourpy and we close this PR?

@dstansby
Copy link
Member Author
dstansby commented Apr 5, 2022

I'm not bothered whether this makes it into 4.0; the only good reason to rush seems to be removing the scikit-image dependency, which I don't think will happen for 4.0, so I'm going to re-milestone this but leave it open.

@dstansby dstansby removed this from the 4.0.0 milestone Apr 5, 2022
@nabobalis
Copy link
Member

I am happy to get this into 4.0 if we decide that removing scikit-image is important enough, if not, waiting for MPL to do the switch is just easier for us? (We would still need to update the contour function tho)

@dstansby
Copy link
Member Author

I think we should hold off on this until MPL makes the switch that won't be before we feature freeze 4.0, so I'm going to close this PR and we can track this at #5874

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.

4 participants
0