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

Remove optional dependence on SciPy for FFT operations #791

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

agriyakhetarpal
Copy link
Collaborator

Description

This PR removes SciPy as an optional dependency for PyWavelets, making NumPy the only dependency. This follows the discussion from #741 (comment).

Changes made

  • Removal of SciPy-related CI options, such as the SCIPY_MIN and USE_SCIPY environment variables and their corresponding jobs created from them, and removal of scipy as a nightly dependency that's installed from the SPNW Anaconda.org index
  • The pywt/data/create_dat.py helper script has been moved to the util/ directory outside the package's source tree.
    The README/manual, the installation guide, and the optional-dependencies table in pyproject.toml no longer mention SciPy as an optional dependency. At some other point, the optional dependencies could be populated with [test] or [docs].
  • PyWavelets now uses numpy.fft to calculate the continuous wavelet transform (through pywt/_cwt.py), as NumPy >=2 has been available for some while now. We could advise users about the performance regression (if they still have NumPy 1.x in their environment) through the release notes. I haven't spent time benchmarking whether SciPy is still faster or not.

Other references to SciPy, such as its intersphinx mapping, and PyWavelets's adoption of its code of conduct from SciPy's, mailing list links, a few code comments, and so on have been kept.

Question(s)

There is a "FIXME:" comment here:

pywt/pywt/_functions.py

Lines 80 to 102 in 281caa4

Examples
--------
>>> from pywt import Wavelet, integrate_wavelet
>>> wavelet1 = Wavelet('db2')
>>> [int_psi, x] = integrate_wavelet(wavelet1, precision=5)
>>> wavelet2 = Wavelet('bior1.3')
>>> [int_psi_d, int_psi_r, x] = integrate_wavelet(wavelet2, precision=5)
"""
# FIXME: this function should really use scipy.integrate.quad
if type(wavelet) in (tuple, list):
msg = ("Integration of a general signal is deprecated "
"and will be removed in a future version of pywt.")
warnings.warn(msg, DeprecationWarning)
elif not isinstance(wavelet, (Wavelet, ContinuousWavelet)):
wavelet = DiscreteContinuousWavelet(wavelet)
if type(wavelet) in (tuple, list):
psi, x = np.asarray(wavelet[0]), np.asarray(wavelet[1])
step = x[1] - x[0]
return _integrate(psi, step), x
which has been pending for some while, as the NumPy implementation for the integration might not have been the ideal choice back then. If we want to fix it, SciPy should stay as an optional dependency, and shouldn't be removed. What do you think we should do? The commit is twelve years old, though: ddda4dd

Additional context

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant