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
MAINT: Update fft.helper
import
#19426
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the change is IMO more substantial than the PR title implies, but from what I can tell, it LGTM.
Approval conditional on passing CI
scipy/_lib/array_api_compat
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the submodule update, and the one relevant change w.r.t. this PR is:
-from numpy.core.numeric import normalize_axis_tuple
+import numpy as np
+if np.__version__[0] == "2":
+ from numpy.lib.array_utils import normalize_axis_tuple
+else:
+ from numpy.core.numeric import normalize_axis_tuple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one was introduced for SciPy specifically: data-apis/array-api-compat#63.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See gh-19406. This change needs to make its way into SciPy at some point, but I don't know whether it should come in a separate PR.
scipy/fftpack/_helper.py
Outdated
from numpy.fft.helper import fftshift, ifftshift, fftfreq | ||
|
||
import scipy.fft._pocketfft.helper as _helper | ||
from scipy.fft._helper import fftshift, ifftshift, fftfreq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
16bda78
to
9e2b873
Compare
Agreed with Peter that we should avoid going through |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is happy and the imports only change to avoid the deprecated NumPy namespace now, after the PR revisions.
Hi!
numpy.fft.helper
submodule was deprecated and accessing it raises a warning (it was renamed to a private namenumpy.fft._helper
).Here I update the import statement in
fftpack
- it usesfftshift
,ifftshift
andfftfreq
functions defined inscipy.fft._helper
submodule. Internally they import the correct (non-deprecated) function from NumPy.