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

inverse method not working for any filter #101

Open
mfarazi1991 opened this issue Sep 28, 2021 · 4 comments
Open

inverse method not working for any filter #101

mfarazi1991 opened this issue Sep 28, 2021 · 4 comments

Comments

@mfarazi1991
Copy link

mfarazi1991 commented Sep 28, 2021

Hi,

I cannot use the inverse method of filterbanks. I did use the exact codes in the commented part of the inverse method in python files and still get the following error:

AttributeError: 'Abspline' object has no attribute 'inverse'

@mdeff
Copy link
Collaborator

mdeff commented Sep 28, 2021

Hi, thanks for your interest! You may be using an older version. Try to install the latest from github with pip install git+https://github.com/epfl-lts2/pygsp. (Discussion in #69.)

@chiragvshukla
Copy link

I'm on the latest version and also facing the same issue.

I'm also a little confused with the way the package works. If I understand correctly, given a wavelet filter g, g.filter(signal) should give the wavelet coefficients c, and g.inverse(c) should reconstruct the signal, right?

@nperraud
Copy link
Collaborator

nperraud commented Nov 2, 2021

To inverse coefficient, you have to use the synthesize function. Synthesis is actually the inverse of analysis (analyze is actually the same as filter). The inverse function returns another filter, and does not inverse the coefficients.

Here is untested pseudo code:

signal = np.random.randn(G.N,1)
inverse_filter = g.inverse()
coefs = g.analyze(signal)
reconstructed_signal = inverse_filter.synthesize(coefs)
np.linalg.norm(reconstructed_signal-signal)

Good luck

@chiragvshukla
Copy link

chiragvshukla commented Nov 2, 2021

Thanks for the pseudo-code and the explanation! The problem still remains in calculating in inverse filter though, since it gives the "object has no attribute 'inverse' " error. Is there a workaround for this?

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

No branches or pull requests

4 participants