Skip to content
Closed
Changes from 1 commit
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
14 changes: 6 additions & 8 deletions src/diffpy/utils/resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

import warnings
from warnings import deprecated

import numpy

Expand Down Expand Up @@ -79,6 +79,11 @@ 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.6.3. \n"
"'resample' has been renamed 'wsinterp' to better reflect functionality. \n"
"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 All @@ -99,13 +104,6 @@ def resample(r, s, dr):
Returns resampled (r, s).
"""

warnings.warn(
"The 'resample' function is deprecated and will be removed in a future release. \n"
"Please use 'wsinterp' instead.",
DeprecationWarning,
stacklevel=2,
)

dr0 = r[1] - r[0] # Constant timestep

if dr0 < dr:
Expand Down
Loading