Skip to content
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

add deprecation warning to resample function #180

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/resample-dep-warning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Deprecation warning for resample function in resampler

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
6 changes: 6 additions & 0 deletions src/diffpy/utils/resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

"""Various utilities related to data parsing and manipulation."""

from warnings import deprecated

import numpy


Expand Down Expand Up @@ -77,6 +79,10 @@ def wsinterp(x, xp, fp, left=None, right=None):
return fp_at_x


@deprecated(
"The 'resample' function is deprecated and will be removed in a future release (3.8.0). \n"
"'resample' has been renamed 'wsinterp' to better reflect functionality. Please use 'wsinterp' instead."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good. Does this decorator also work in Python 3.12 and 3.11 without failing the test?

Copy link
Author

Choose a reason for hiding this comment

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

I'll test on that and make a new PR based on the new structure

Copy link
Author

Choose a reason for hiding this comment

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

@bobleesj this deprecated decorator actually is only released for 3.13 so should I use warnings.warn instead? @Sparks29032

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's a new feature for 3.13.

If it doesn't work for 3.11 and 3.12, then I suggest we should not use this decorator since then 3.11 and 3.12 users won't be able to read this warning msg. tagging @sbillinge for his opinion too.

def resample(r, s, dr):
"""Resample a PDF on a new grid.

Expand Down
Loading