Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mnt deprecate mlab#22920

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
jklymak wants to merge3 commits intomatplotlib:mainfromjklymak:mnt-deprecate-mlab
Closed

Conversation

jklymak
Copy link
Member

PR Summary

These are all somewhat fragile wrappers around functionality that rightly belongs elsewhere in the python scientific stack. There is nothing particular to plotting in these routines, and simply predate widely available scipy.signal and scipy.stats. I guess some onecould make a new toolbox, but I'm not sure what would be in it...

Obviously this needs wide agreement before proceeding.

Draft until I can see what fails.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@jklymakjklymak added the status: needs comment/discussionneeds consensus on next step labelApr 27, 2022
@@ -840,6 +846,7 @@ def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
return Cxy, f


@_api.deprecated("3.6", alternative="scipy.stats.gaussian_kde")
Copy link
Member

Choose a reason for hiding this comment

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

We use this internally for violin plots iirc...

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

yeah, I was just abusing CI and waiting for things to fail before figuring what needed to be changed elsewhere. Worst-case if I can't make KDEs work directly from scipy I'd still suggest we deprecate this as a public method.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

oh, hold it, do we still not require scipy as a hard requirement? I guess that means violinplots need us to vendor this?

tacaswell reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

OK backed out this change. I didn't make this private either because the docs leave it possible to pass a GaussianKDE object to violinplots.

@@ -2900,16 +2895,14 @@ def streamplot(
x, y, u, v, density=1, linewidth=None, color=None, cmap=None,
norm=None, arrowsize=1, arrowstyle='-|>', minlength=0.1,
transform=None, zorder=None, start_points=None, maxlength=4.0,
integration_direction='both', broken_streamlines=True, *,
Copy link
Member

Choose a reason for hiding this comment

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

This change seems strange.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

ooops, Looks like I deleted it by accident. Thanks for catching....

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Oh, hmmm. I'm not doing this - its boilerplate.py. I'm not actually clear what is going on here....

Copy link
Member

Choose a reason for hiding this comment

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

Strange. Is boilerplate executed automatically or manually? (Sorry for my ignorance.)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Manually. This commit I've not executed boilerplate, and it seems better plus or minus the font-finding problem, which I believe is unrelated

@jklymak
Copy link
MemberAuthor

Discussed on call. OK to go ahead with this. Vendor GaussianKDE and make the current version private.@oscargus if you were still interested in pulling this out as a toolbox that would be fine as well, but we will deprecate here. Maybe if the toolbox is set up we can change the deprecation messages to point to it?

@oscargus
Copy link
Member

@jklymak I'm interested in a toolbox with related functions, yes. While these may not be the ones I use and focus, it may very much make sense to add them there.

I'll see if I can come up with something quite soon, at least before 3.6... Not sure if we should wait with merging this until we can point to it (matplotlib/mpl-signal or something) or if we simply should prepare a new PR later on and merge this when (if) decided.

@jklymak
Copy link
MemberAuthor

I don't think there is a rush for the deprecation if you think you will have something in a couple of months.

@anntzer
Copy link
Contributor

anntzer commentedApr 28, 2022
edited
Loading

oh, hold it, do we still not require scipy as a hard requirement

I'm certainly OK with deprecating spectral functions from mlab, but I would much rather not add a dependency on scipy. While conda is mostly always available these days, in the rare cases where it's not and no wheels are available (e.g. shortly after new python releases), compiling scipy can be a huge pain (due to the fortran parts), much worse than numpy and matplotlib.

@jklymak
Copy link
MemberAuthor

Yes, that was the consensus on the call - just vendor GaussianKDE. The other functions thatshould depend on scipy, but do not, will just be flat out deprecated, and maybe moved to a different toolbox if people really complain about the lack of apsd function.

anntzer reacted with thumbs up emoji

@tacaswell
Copy link
Member

If we want to have a signal related toolkit it makes the most sense for it to be a stand-alone package so you can apologetically depend on scipy!

@oscargus
Copy link
Member

Started a bit on the toolbox:https://github.com/oscargus/mplsignal so can easily move relevant functions there when needed. (I expect to maybe release a first version in a few weeks and may ask to have it move to the mpl organization before that as I expect to move it at some stage anyway,)

Btw, the idea is to not depend on scipy there either (even though some functions are customized to fit exactly into some scipy-functions likefreqz that has a plot-callback), so at least provide some fallback functions.

@jklymakjklymak marked this pull request as ready for reviewMay 9, 2022 23:49
@jklymak
Copy link
MemberAuthor

I'm completely befuddled as to why this PR fails font-name tests. I rebased off master, and I don't see any way I touched font handling. Something weird is going on...

@jklymakjklymak removed the status: needs comment/discussionneeds consensus on next step labelMay 10, 2022
@jklymakjklymakforce-pushed themnt-deprecate-mlab branch 2 times, most recently fromd804f02 to78aff43CompareMay 16, 2022 08:35
@jklymakjklymak added this to thev3.6.0 milestoneMay 18, 2022
@oscargus
Copy link
Member

oscargus commentedJun 5, 2022
edited
Loading

I realized that we either should deprecate the corresponding functions in pyplot/Axes as well or make sure that they use the non-deprecated versions directly from numpy (where possible) or scipy (and fail gracefully if it is not installed).

I could open a PR using the numpy functions directly if that is the preferred solution (but will not spend time otherwise).

Edit: I was a bit too quick here and realize that it is onlyxcorr andcohere that relies onmlab. Still it would require some change. Probably we should keep windows and detrends?

Edit 2: But considering that the tests are removed, which are really tests for pyplot functions, there is still an issue to consider here.

@oscargusoscargus mentioned this pull requestJun 5, 2022
@jklymak
Copy link
MemberAuthor

jklymak commentedJun 7, 2022
edited
Loading

I realized that we either should deprecate the corresponding functions in pyplot/Axes as well or make sure that they use the non-deprecated versions directly from numpy (where possible) or scipy (and fail gracefully if it is not installed).

We should definitely deprecate those!

...done.

@jklymakjklymak marked this pull request as draftJune 7, 2022 11:06
@jklymakjklymak marked this pull request as ready for reviewJune 7, 2022 12:51
@jklymakjklymak mentioned this pull requestJul 17, 2022
6 tasks
@anntzer
Copy link
Contributor

What's the status here? Is this dependent on mplsignal being released on PyPI? (It doesn't seem to be there yet.)
Normally the tests should only be removed when the implementations are removed too (they should be protected withwith pytest.warns(...): in the meantime)?

commands with the same names. Most numerical Python functions can be found in
the `NumPy`_ and `SciPy`_ libraries. What remains here is code for performing
spectral computations and kernel density estimations.
This module is deprecated in favour of modules that can be found in
Copy link
Contributor

Choose a reason for hiding this comment

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

In the long-term, will GaussianKDE live in another module? Or will mlab stay around to host it?

@jklymak
Copy link
MemberAuthor

What's the status here? Is this dependent on mplsignal being released on PyPI? (It doesn't seem to be there yet.)

I don't think this should wait for a replacement package.

Normally the tests should only be removed when the implementations are removed too (they should be protected with with pytest.warns(...): in the meantime)?

OK, I can do that

In the long-term, will GaussianKDE live in another module? Or will mlab stay around to host it?

It probably should get put somewhere else, but seems a bit cumbersome to move it now.

@jklymak
Copy link
MemberAuthor

Normally the tests should only be removed when the implementations are removed too (they should be protected with with pytest.warns(...): in the meantime)?

OK, I can do that

Actually thats a pretty huge PITA - test_mlab has >100 tests, most of which now fail due to the deprecation warning.... Surely I don't have to wrap them all in awith pytest.warns(...): ?

@anntzer
Copy link
Contributor

@jklymakjklymakforce-pushed themnt-deprecate-mlab branch 2 times, most recently from019b0e7 to4e341cbCompareJuly 20, 2022 19:56
@jklymak
Copy link
MemberAuthor

OK, tests marked to filter deprecation warnings. I assume we don't need to wrap the individual calls to allowother deprecation warnings to be caught, so this should be fine. This needs a rebase before merging to undo the files that were removed and then added.

pytest.ini Outdated
@@ -1,12 +0,0 @@
# Because tests can be run from an installed copy, most of our Pytest
Copy link
Contributor

Choose a reason for hiding this comment

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

This file should stay.

@@ -1,1074 +0,0 @@
from numpy.testing import (assert_allclose, assert_almost_equal,
Copy link
Contributor

Choose a reason for hiding this comment

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

My suggestion was to keep this as well (with a global pytestmark to filter warnings everywhere in the file), but I guess the Axes tests essentially cover what we want too?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yep, sorry, I forgot I had to "add" it...

.... except for GaussianKDE, which is needed for violinplots
@@ -69,6 +68,7 @@ def window_hanning(x):
return np.hanning(len(x))*x


@_api.deprecated("3.6", alternative="")
Copy link
Member

Choose a reason for hiding this comment

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

Missing alternative.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Its a no-op? I guess I could saylambda x: x.

Copy link
Member

Choose a reason for hiding this comment

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

alternative="" is the default. You don't have to specify this explicitly.

I'm fine either way: Don't give an alternative (we don't have to specify one). Or uselambda x: x.

@@ -157,6 +159,7 @@ def detrend_mean(x, axis=None):
return x - x.mean(axis, keepdims=True)


@_api.deprecated("3.6", alternative="scipy.signal.detrend")
Copy link
Member

Choose a reason for hiding this comment

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

That doesn't seem to be right alternative?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed!

@jklymakjklymakforce-pushed themnt-deprecate-mlab branch 2 times, most recently fromdf4fe34 tocb27276CompareJuly 22, 2022 00:34
@QuLogicQuLogic modified the milestones:v3.6.0,v3.7.0Aug 24, 2022
@jklymak
Copy link
MemberAuthor

This one is a bit annoying to drag from milestone to milestone. I still feel we should deprecate all this, but if we aren't going to do it, then let's close the PR. Thanks!

@jklymak
Copy link
MemberAuthor

... we are about to feature freeze for 3.7 - if we would like this change, now is the time to do it, otherwise, we can close this...

@oscargus
Copy link
Member

I should be able to get it into mplsignal and make a first release during the holidays.

timhoffm reacted with hooray emoji

@jklymak
Copy link
MemberAuthor

OK, I'll close this as I don't see it getting in before 3.7 is frozen, and I'm not willing to rebase it to 3.8. I think we should not be providing this, but understand if folks want to keep it around.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@QuLogicQuLogicQuLogic left review comments

@anntzeranntzeranntzer left review comments

@timhoffmtimhoffmtimhoffm left review comments

@oscargusoscargusoscargus left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

6 participants
@jklymak@oscargus@anntzer@tacaswell@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp