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

normalization issue for DTCWTDirect #47

Closed
xir4n opened this issue May 29, 2024 · 3 comments
Closed

normalization issue for DTCWTDirect #47

xir4n opened this issue May 29, 2024 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@xir4n
Copy link
Collaborator

xir4n commented May 29, 2024

the coefficients don't seem to be normalized correctly when setting alternate_gh=True:

N = 44100
x = torch.zeros(1, 1, N)
x[0, 0, N//2] = 1
J = 8

dtcwt = murenn.DTCWT(J=J, alternate_gh=False)
idtcwt = murenn.DTCWTInverse(J=J, alternate_gh=False)

x_phi, x_psis = dtcwt(x)
y_j = []

for j in range(J):
    y_phi = x_phi * 0
    y_psis = [x_psis[k] * (j==k) for k in range(J)]
    y_j.append(idtcwt(y_phi, y_psis).squeeze())

lp_psis = [torch.zeros(x_psis[k].shape) + 1j*torch.zeros(x_psis[k].shape) for k in range(J)]
y_lp = idtcwt(x_phi, lp_psis).squeeze()

plt.figure(figsize=(10, 3))
for j in range(J):
    y_jhat = torch.fft.fft(y_j[j])
    plt.semilogx(range(N), torch.abs(y_jhat), label=f'j={j+1}')
y_lphat = torch.fft.fft(y_lp)
plt.semilogx(range(N), torch.abs(y_lphat), label=f'lp')
plt.grid(linestyle='--', alpha=0.5)
plt.xlim(0.5, N//2)
plt.title('Frequency responses')
plt.legend()

output:
image

@xir4n xir4n added the bug Something isn't working label May 29, 2024
@lostanlen
Copy link
Contributor

lostanlen commented Jul 2, 2024

after our conversation today, it seems like the best option is simply to remove the normalize optional argument? since normalize=True introduces bugs and serves no clear purpose

EDIT normalize is still useful.

@xir4n xir4n mentioned this issue Jul 7, 2024
@xir4n
Copy link
Collaborator Author

xir4n commented Jul 23, 2024

Pasted image 20240722183000

@lostanlen
Copy link
Contributor

seems like setting alternate_gh=False in #56 solved the problem ...
shall we close this?

@xir4n xir4n closed this as completed Jul 25, 2024
@lostanlen lostanlen added this to the 0.3 milestone Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants