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

upcoef - TypeError: No matching signature found #338

Closed
djessop opened this issue Dec 5, 2017 · 2 comments · Fixed by #339
Closed

upcoef - TypeError: No matching signature found #338

djessop opened this issue Dec 5, 2017 · 2 comments · Fixed by #339
Milestone

Comments

@djessop
Copy link

djessop commented Dec 5, 2017

I've come across this error when trying to reconstruct data from the coefficients given by dwt2 in a project to port some matlab code to python. An example of the data and code that I'm using is given below.

data = np.array([[ 1.47728539, 1.59481049, 1.59481049, 1.46021461, 1.44889259], [ 1.48014069, 1.48872185, 1.67795181, 1.38459396, 1.32822609], [ 1.41849327, 1.57595444, 1.50884819, 1.44937897, 1.57595444], [ 1.46079826, 1.53956032, 1.54245186, 1.53089523, 1.49732971], [ 1.49732971, 1.4323349 , 1.44937897, 1.49158859, 1.48872185]])

ca, (_, _, _) = pywt.dwt2(data, 'db1')

reconstructed = pywt.upcoef('a', ca, 'db1')

`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 pywt.upcoef('a', ca, 'db1')

/usr/local/lib/python3.4/dist-packages/pywt/_dwt.py in upcoef(part, coeffs, wavelet, level, take)
341 if part not in 'ad':
342 raise ValueError("Argument 1 must be 'a' or 'd', not '%s'." % part)
--> 343 return np.asarray(_upcoef(part == 'a', coeffs, wavelet, level, take))

/usr/local/lib/python3.4/dist-packages/pywt/_extensions/_dwt.cpython-34m.so in pywt._extensions._dwt.__pyx_fused_cpdef (pywt/_extensions/_dwt.c:7860)()

TypeError: No matching signature found`

However, using idwt2 works and gives approximately the same answers compared to the matlab code that uses the native upcoef2 function.

coeffs = (ca, (None, None, None))

reconstructed = pywt.idwt2(coeffs, 'db1')

I think that this kind of TypeError is usually raised when there is a conflict between type definitions, but everything is of type numpy.ndarray and dtype float64.

@grlee77
Copy link
Contributor

grlee77 commented Dec 5, 2017

The problem in your use case is that pywt.upcoef only supports 1D data (The underlying Cython code for upcoef is expecting a contiguous 1D array).

We do not currently have a 2D version of upcoef that operates like Matlab's upcoef2.

@grlee77
Copy link
Contributor

grlee77 commented Dec 5, 2017

I opened #339 to provide a more useful error message in this case.

@grlee77 grlee77 added this to the v1.0 milestone Jul 18, 2018
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 a pull request may close this issue.

2 participants