Skip to content

Commit

Permalink
Use PyWavelets for continuous wavelet transform
Browse files Browse the repository at this point in the history
scipy 1.15.0 has been released, and with it, signal.cwt has been
removed[1]. The suggested recommendation is to use PyWavelets.

1: https://docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.signal.cwt.html
  • Loading branch information
s-t-e-v-e-n-k committed Feb 6, 2025
1 parent e4f864c commit 64a5868
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pillow
numpy
scipy
argparse
PyWavelets
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
author_email='[email protected]',
platforms=['any'],
license='MIT License',
install_requires=['numpy', 'pillow', 'scipy'],
install_requires=['numpy', 'pillow', 'scipy', 'PyWavelets'],
url='https://github.com/jterrace/pyssim',
entry_points={
'console_scripts': [
Expand Down
6 changes: 3 additions & 3 deletions ssim/ssimlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys

import numpy as np
from scipy import signal
import pywt

from ssim import compat
from ssim.compat import Image, ImageOps
Expand Down Expand Up @@ -168,8 +168,8 @@ def cw_ssim_value(self, target, width=30):
sig2 = np.asarray(target.img_gray.getdata())

# Convolution
cwtmatr1 = signal.cwt(sig1, signal.ricker, widths)
cwtmatr2 = signal.cwt(sig2, signal.ricker, widths)
cwtmatr1, freqs1 = pywt.cwt(sig1, widths, 'mexh')
cwtmatr2, freqs2 = pywt.cwt(sig2, widths, 'mexh')

# Compute the first term
c1c2 = np.multiply(abs(cwtmatr1), abs(cwtmatr2))
Expand Down

0 comments on commit 64a5868

Please sign in to comment.